AppleScript is a proprietary programming language in Mac OS X to control and exchange data with applications.

learn more… | top users | synonyms (3)

3
votes
1answer
986 views

How do I return the number of the current window in Chrome and open a new tab in it?

I am writing an AppleScript in which I need to get the number of the current window of Google Chrome and open a new tab in it. I want something like this (pseudo code): set curWindNum to the current ...
3
votes
1answer
1k views

AppleScript to display the VPN status bar area icon

I am trying to write an AppleScript to connect to a VPN service. Once connected to the VPN, I want to display the VPN icon in the status area of the menu bar. I've gotten as far as connecting to ...
1
vote
1answer
2k views

Automator workflow or AppleScript to close Safari after a period of time

I would like to create an Automator workflow (or some similar function) that will close down Safari after a specified period of time. For instance, I simply want to run Pandora in Safari during the ...
1
vote
1answer
183 views

Forwarding a mail as a fax using Applescript and Mail

I am using the Mac's fax function and that works just great. I would, however, like to make an Applescript that gets called from a Mail rule. For example, when the Subject is something like: ...
1
vote
1answer
1k views

Ejecting USB drive via AppleScript does not make drive power down

On startup, I eject my external USB disks with the following AppleScript: try do shell script "diskutil eject \"/Volumes/USB Backup\"" end try This works as expected: the drive powers down. ...
2
votes
1answer
5k views

Why is my applescript for checking if a file exists failing?

I have an applescript application that inputs a username and starts a download based on that username. In the app I use the code below to check if a file exists already and then rename the file if it ...
4
votes
1answer
132 views

Applescripting ODBC

Is it possible to interact with an ODBC connection within AppleScript? Or must one break out into another process (e.g. Python, Perl, etc)?
12
votes
1answer
7k views

How do I find out the applescript commands available for a particular app?

I'm trying to find out if I can get iTunes to do something complex, but don't know what can be scripted. Is there a way to find out what applescript commands an app will respond to?
3
votes
1answer
2k views

Run AppleScript after waking from Sleep?

Is there an easy way to run an AppleScript or application immediately (or a brief delay of X seconds) after waking up from sleep? I'm looking for a solution that doesn't involve a 3rd-party app.
0
votes
1answer
4k views

Use AppleScript to launch and manage Quicktime Player in the background

I have a Perl-based audio player that runs on OS X, and I need to update how the audio files are played. I'd like to use AppleScript to control the QuickTime Player, because it will do what I need, ...
1
vote
1answer
660 views

Modifying “User interface sound effects” with applescript

Good morning all, I would like to be able to turn the system sounds on my mac off (and back on) with an applescript activated as an extension for Alfred. I have little knowledge of applescripts but I ...
3
votes
1answer
711 views

Combining Finder's File Open/save dialog with Alfred

Finder's Open/Save File dialog is actually very dumb (in terms of flexibility). When I look for a file or its location, I can probably find it much faster using Alfred. However, in many cases, you ...
6
votes
1answer
1k views

How can I update iTunes Match from the command line?

I use iTunes Match to access my iTunes library at work. I added some new music to my library (back at home) recently, but I forgot to run the "Update iTunes Match" command to ensure that the songs ...
2
votes
4answers
1k views

cron is failing to run my AppleScript

I have the following code in a text file (myfile.applescript): #! /usr/bin/osascript tell application "Google Chrome" to quit I would like Chrome to shut down each night at 9:15PM, so I added the ...
3
votes
1answer
616 views

How to Unset iTunes Track Start And Stop Time For Multiple Tracks?

For some reason a lot of tracks in my iTunes library have senseless start and stop times set. This is really annoying as some tracks get skipped after a few seconds. There are Apple Script commands ...
3
votes
2answers
573 views

How can I successively trigger an AppleScript very quickly?

Background For fine volume adjustment I use the following AppleScript: try do shell script "killall afplay" end try set currentVolume to output volume of (get volume settings) set volume output ...
2
votes
2answers
2k views

Creating wrapper script for Mail.app to send mail from Terminal

I'm trying to send mail from terminal with the help of bash and applescript. I use bash for taking care of arguments and the email message body. Then I have tried using Applescript to send the mail ...
5
votes
2answers
1k views

Is there a way to have AppleScript output displayed in the menubar?

Before reading further: I know about butler and similar programs. I am looking for a BUILT-IN way to do this without a third party app. Anyway, I wrote an AppleScript that runs a shell command. I ...
3
votes
2answers
206 views

LaunchBar script that returns the path of a folder “dropped” on it

I want to make a LaunchBar script that displays in a dialog the path of a file or folder that's chosen in the first pane and then "dropped" on a script. But I can't make it work. I've got a couple of ...
0
votes
0answers
24 views

Launch program after inactivity [duplicate]

Possible Duplicate: How can I automatically launch an application whenever the Mac goes idle? I'd like to launch an AppleScript/ App after 30 minutes of system inactivity. e.g. no cursor ...
5
votes
1answer
511 views

How can I use an Applescript from within a program?

This question Is there a way to add all of the recipients of an email to a group/folder in contacts from Mail? seems to have an answer that would be useful for me, but I don't actually know how to use ...
13
votes
5answers
4k views

OS X right click/context menu via keyboard

Is it possible to access the right click/context menu of the currently selected item (not the item under the mouse) by way of using a keyboard shortcut? If not, is there any way to achieve this, ...
5
votes
2answers
1k views

A programmatic method for disabling all sharing services?

I'm seeking a programmatic method for disabling all the sharing services on a Mac. My preference is for an AppleScript or a shell script. I'd like to have the services shown in the picture below ...
2
votes
2answers
453 views

Safari bookmark to activate an Automator action

I'm trying to make a HTML page that I can save as a bookmark in Safari or Google Chrome that runs an Automator workflow, action or application, or possibly an Applescript. It's only for my personal ...
1
vote
2answers
853 views

How do I set podcast release date in iTunes using Applescript?

I would like to add the release date to podcasts that I've imported into iTunes, but my applescript is returning an error about the date object. tell application "iTunes" set theSelection to ...
3
votes
2answers
2k views

Terminal: Path to Network Drive in Applescript

I am trying copy a file up to a network drive in AppleScript. Normally I would do.. do script "mv ~/Desktop/file.txt ~/Folder/file.txt" What is the correct path to a network drive? I normally ...
8
votes
4answers
13k views

How to know the name of UI elements using Accessibility inspector (or any other tool)

I'm trying to interact with a print dialog via Applescript. What I want to emulate is the user setting a value on a specific dropdown. Say I have: tell application "System Events" tell process ...
4
votes
2answers
5k views

When MouseKeys are on, how do I click or move the mouse using AppleScript?

This post suggests that the command tell application “System Events” to key code 37 in AppleScript should move the mouse pointer one pixel down and to the left if run when MouseKeys are enabled. In OS ...
4
votes
2answers
469 views

Is there a definitive reference or introspection capability for Applescript?

Is there some canonical place I can find a reference for the scripting capabilities various things have in AppleScript? For instance, I'd like to automate iTunes a little bit. Looking around on the ...
3
votes
2answers
2k views

Is there a way to turn on and off the Mouse Keys feature using AppleScript or a terminal command?

I'm running Mac OS X 10.7.2. Is there a way to run an AppleScript or terminal command that quickly turns on or off the "mouse keys" feature under the Universal Access tab? Ideally I'm looking for a ...
2
votes
2answers
1k views

Is it possible to switch to a specific keyboard layout via `defaults`, *.plist or similar?

I have figured out a workable shell script using osascript (AppleScript) to automatically switch to US keyboard layout when MacVim activates (triggered by Keyboard Maestro), and Swedish layout when it ...
2
votes
2answers
156 views

Make a file a Stationery pad via command line

Is there a way to set make a file into a Stationery pad from the command line? You can do it by clicking "Get info" on a file and checking the box, but I would like to do it without clicking. An ...
0
votes
1answer
352 views

Generate an iOS Project (.xcodeproj) with AppleScript

How can I generate an iOS project (.xcodeproj) with AppleScript (without XCode)?
6
votes
3answers
7k views

Script to raise a single window to the front

In a script I'm trying to find the Terminal.app window containing a specific tty device and raise that window to the top. Here's what I have in Applescript so far: tell application "System Events" ...
11
votes
5answers
3k views

How can I automatically launch an application whenever the Mac goes idle?

Is there a way to launch an application, such as Transmission, every time the computer goes idle (instead of sleeping)?
0
votes
1answer
149 views

How can I make a keyboard configuration become default when I hook it up?

At work, I have a MacBook Pro and a RHEL workstation that share a HP keyboard and mouse via a KVM switch. I do most of my work on the Mac so I prefer to change the modifier keys so they command and ...
1
vote
1answer
301 views

Automator Service that does predefined simple calculations

I'm working as a salesman and what I need to do a lot of times a day is calculating the price +VAT and -VAT which is 19% here in Germany. I found some calculation automator script but wasn't able to ...
0
votes
2answers
2k views

How to run a downloaded run-only Applescript

I am trying to run an Applescript, but when I double-click it, it tries to open Applescript editor and informs me that it was saved as "run only". This is fine -- I just want to run it! The script in ...
3
votes
1answer
826 views

How can I generate dynamic keynote presentations?

I'd like to build a series of Keynote presentations that contain some dynamic elements. By that I mean some elements are "compiled" in later. For example if I have a code sample on a slide, I want to ...
3
votes
3answers
2k views

Show text using Large Type without relying on third-party applications

Apple has this amazing feature called 'Large Type', chiefly implemented into Address Book. When you look up a contact, you can right-click the phone number and click 'Large Type', and it will display ...
0
votes
1answer
137 views

How do I refresh Application metadata - URL handlers, Web browsers - after installing my own AppleScript?

I'm working on an Apple Script that handles URLs. There's a command one can give which re-creates the list that Safari shows to change the default web browser. Anyone know what this is?
1
vote
1answer
358 views

Running AppleScript When Inserting a Blank CD

I want to automatically burn a cross-platform data CD with the same contents each time a blank disc is inserted, and eject it when done. To that end I created a very simple AppleScript that does just ...
1
vote
2answers
904 views

Automatically delete temporary ~/Library/Application Support folders

I have a flash drive which I carry around everywhere which has a few standalone applications which I use everywhere installed on it. However, the majority of these leave Application Support folders ...
3
votes
3answers
11k views

How can I remove a portion of from the middle of a movie?

Quicktime Player help: With QuickTime Player you can quickly remove a portion of the beginning or end of a movie or a movie clip to make it shorter or remove unwanted content. I want to ...
1
vote
2answers
755 views

FTP Client with AppleScript support

I'm looking for an FTP client with the following requirements. File/Folder sync Sftp/SSH tunnelling Outstanding AppleScript support Runs on Lion The GUI interface is not overly important as it ...
27
votes
1answer
65k views

How do I automate a key press in AppleScript?

Is it possible to automate the key press of a key (such as "a" or "<") in Mozilla Firefox, Google Chrome or Safari (in this order)? I'd like to automate the key press of "a" for example in Mozilla ...
2
votes
3answers
5k views

/bin/sh: rm: command not found

I have problems with some applications that use AppleScript shell script feature. For example, Growl's uninstall scripts shows an error: error "/bin/sh: rm: command not found" number 127 The source ...
1
vote
2answers
630 views

Applescript - ignore modifier keys

I have an applescript that needs to be called by an external program with command-shift-click. However, the applescript then performs keystrokes with command & shift held down. How do I get ...
2
votes
2answers
2k views

AppleScript “Kill” Command Error

I am attempting to run an AppleScript every 24 hours to close a running application and restart it. I have used the following code successfully with other Apps: repeat delay 84600 set app_name ...
2
votes
3answers
622 views

How can I run a PHP script by dropping file on icon?

I have a php script that takes a filename as an argument. When I run it from a terminal window I type ./my_script.php file_to_process.txt It works great! What I would like to be able to do is to ...