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

learn more… | top users | synonyms (2)

48
votes
4answers
20k views

How can I trigger a Notification Center notification from an AppleScript or shell script?

I'd love to be able to take advantage of 10.8's Notification Center features in AppleScripts and shell scripts I write. Is there a built-in command or a third-party library I can use from either an ...
1
vote
1answer
86 views

how to capture folder as input and pass it to python script as argument

How to capture folder as input and pass it to python script as argument? This is what I have so far, but this is always taking the user home directory as input no matter which folder i right click > ...
0
votes
1answer
60 views

How to search through online сhеss games using AppleScript or Automator?

I would like to search for specific online сhеss games. Each game has a single adress. Since there are millions of games on instant chess, it would take far too long to index all the games. So I will ...
1
vote
0answers
53 views

Encrypting a PDF during Hazel processing

I've created an Automator Workflow which can take the selected Finder item (being a PDF) and encrypt it using the Apple-provided "Encrypt PDF Documents" action. The problem with this action is it ...
3
votes
2answers
192 views

Can AppleScript be used to downloading files from a web page?

I want to write a script that searches a web page for an updated file, then downloading it when detected. There is no command I have found that does this, accept Automator's download URL function, ...
1
vote
1answer
841 views

Applescript to type text, followed by a modifier key combo?

I want to use TextExpander to activate when I type the specific text "attached", and have the AppleScript type out the word "attached" (since TextExpander will remove it), and then invoke the ...
0
votes
0answers
41 views

Applescript for moving recently added files (not created or modified) to another folder?

I would like to get a recent downloaded pdf file ( !: it corresponds to the Finder sort method Date Added, not Date Created nor Date Modified) and either just moving to one another folder (if using ...
2
votes
1answer
48 views

Simulate CTRL+F12 2 second keypress

Im trying to bring up the OS X shutdown dialogue box by simulating the key press Control+F12 for 2 seconds (using a logitech keyboard). No matter how much I try I just can not get it to work. My ...
0
votes
1answer
328 views

Printer Setup Utility gone in Mavericks, how to set default printer in Applescript now?

I have some Applescripts that set the default printer using "Printer Setup Utility", that seems gone in Mavericks. Anyone have an alternative to suggest?
1
vote
0answers
160 views

AppleScript for moving mail messages to OmniFocus is creating duplicates in OmniFocus

I'm trying to customize this script to import all flagged mail messages in Mail.app to Omnifocus, then unflag and archive the message. It works, but it creates many duplicates in the Omnifocus inbox ...
1
vote
1answer
128 views

Go to the Running Safari And Press Enter Using AppleScript

I'm very new to AppleScript and I'm trying to do this. I have an Safari process running on my machine. I wish I could go to the running safari and stimulate an enter key event. Is it possible to do ...
2
votes
1answer
83 views

How can I rename an ordered list of files with an ordered list of file names?

I have a series of files. I need to apply a series of file names. So, 001.jpg -> apple.jpg 002.jpg -> banana.jpg 003.jpg -> orange.jpg etc. I will have to repeat this for each of 16 folders with ...
1
vote
2answers
575 views

automator to run AppleScript for a shell script

For a selected file in Finder, I like to run a perl script using Services. I created an Automator process that runs an AppleScript: on run {input, parameters} tell application "Terminal" ...
2
votes
1answer
316 views

Using Hazel or AppleScript to Convert Word to PDF

I use Hazel to sort and rename files. I would like to use Hazel to automatically convert Word docs to PDF. I think this best way to do this is with AppleScript. I have searched extensively online, but ...
0
votes
0answers
51 views

How to run an AppleScript whenever a VNC connection is established?

I want to run a script whenever any user connects remotely to my Mac. I've Googled a bit about it but no perfect tutorial is there. I am less comfortable working with OS X.
6
votes
1answer
737 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 ...
1
vote
1answer
626 views

applescript to find contacts that are not in any group

I have been using a script that does not work anymore in mountain lion even though I have changed the words "address book" to "contacts". If you select all the contacts, and then use the script, it ...
1
vote
2answers
74 views

How to display the MiniPlayer in iTunes with AppleScript?

I use an Automator workflow to open iTunes at startup, etc. I'd like it to open the MiniPlayer window. I don't see a function to do that in Automator. How could I do this with an AppleScript script? ...
3
votes
1answer
1k views

How to avoid the GUI password prompt when using `osascript`?

I’d like to use the osascript shell command to run some AppleScript, but I’d rather avoid the GUI password prompt. Instead, I’d prefer to run the script as sudo from the command-line, so no GUI ...
1
vote
2answers
275 views

AppleScript and Finder - How to detect an “empty” selection when copying paths to the clipboard (Expanded Question)

I'm trying to build a Service that does the following: If some folder/files are selected in Finder, copy (all) the paths to the clipboard If nothing is selected, copy the "Path" of the window. ...
0
votes
0answers
30 views

Change destination mailbox of Command+Control+A in Mail

In my Mail.app, I have only one account set up, which is an Exchange account. When I click on a message on my Inbox (which is a server folder), and press Command+Control+A to archive it, Mail.app ...
2
votes
2answers
304 views

Automate taking a screenshot of specified area

I am trying to use automator to take a screen shot of a specified area. Though I can only find the option of taking a screenshot of a windows or the entire screen. Is there a option to to this with ...
0
votes
1answer
136 views

How to ask for a mail folder in applescript?

I apologise in advance since this will be a long question. I hope that somebody with applescript knowledge can help me. I am transferring whole of my Windows machines to Apple and I am stuck with one ...
2
votes
2answers
690 views

Applescript Click “Go” and “Open” - dialog inside application

In PCSX, (ps1 emulator), I'm trying to automate the steps to play an ISO. So, I'm doing this: set thepath to path to me set thesecondpath to POSIX path of thepath set thethirdpath to ...
1
vote
1answer
391 views

Script to delete all groups in contacts

I would like to have a script to delete all my groups in my Contacts. Somehow I got a kind of replication bug resulting in over 500 groups. Delete them one by one is not an option. Tried this script, ...
2
votes
1answer
427 views

Applescript to copy folder (and contents) to current location?

I am trying to create a button on my Finder toolbar powered by applescript to make a copy of a set folder (e.g. /Users/James/doc) and all files/subfolders within it to the current location in Finder. ...
1
vote
1answer
89 views

Transfer labels (“tags”) from a SMB share to an AFP share

I had a SMB share from my NAS (based on illumos aka OpenSolaris, I used the kernel CIFS) and now I installed Netatalk for better performances. The metadata apparently cannot be read back, that means ...
2
votes
0answers
43 views

Sort Stickies by desktop

I have OS X Lion 10.7.5 with four desktops and also have 4 groups of stickies (one group per desktop). Every time that I have to reopen the Stickies app, they are unsorted (all stickies open on the ...
0
votes
1answer
78 views

Windows positioning with applescript

I want to set the position of some windows to certain coordinates. In particular I have 4 possible positions that those windows should have. For example if I have 4 windows opened I want them to go ...
2
votes
1answer
65 views

Why does “if exists” fail with a false positive?

The file, "Test.file" in the below code does not exist, yet the script returns true. Why? What am I doing wrong? set thePath to (path to application support folder from user domain) if exists ...
7
votes
2answers
127 views

How would I go about making a stand alone app on my dock to open a game using a terminal command?

I have a game that they never released for mac, and I installed the game using WINE, the install itself was flawless, but every time I want to play it, I'm forced to open Terminal and run cd ...
2
votes
3answers
78 views

Create hotkey to insert text

I want to create a hotkey command that insert this text "/" in whatever application I'am The reason is because I'm a developer and I use the / symbol a lot, the problem is with my keyboard layout, ...
0
votes
0answers
45 views

Script to change mail heading

I often need to change the heading of a received mail item, so that I can find it again in a Mail folder. Easy on Outlook, not in Mail. I found a tip as to how to do it (possibly on this forum): ...
1
vote
1answer
40 views

Getting the lower variable

In applescript I have 4 variables, each one with its number. I'd like to have a function that tells me which variable is set to the lower number. EG. set one to 12 set two to 55 set three to 2 set ...
1
vote
2answers
73 views

Escaped path in AppleScript adds leading /

I have the following AppleScript that I am trying to debug: tell application "System Events" set theResult to (do shell script "sqlite3 ~/Library/Application\\ Support/Dock/desktoppicture.db ...
1
vote
1answer
43 views

Can't save AppleScript file when created by touch

I'm used to create file using touch before opening them with open. But I came to this following problem : When I do this with AppleScript files AppleScript Editor is able to open the file but unable ...
2
votes
2answers
1k views

How to fast set hot corners in Mavericks?

I used a downloaded applescript to fast enable/disable hot corners but they don't work after I upgrade to Mavericks. Someone knows what's happening? Here's the disable script, hope it'll help you ...
0
votes
0answers
92 views

Applescript to enable internet sharing, but select where to share the connection from

I have the following applescript code that turns on internet sharing. What I want to be able to do is also have the applescript choose which connection I am sharing from the dropdown menu list. 1 ...
2
votes
1answer
34 views

Best way to distribute script with low friction

I have helped a few friends recently with fixing a problem on OS X and I would like to turn it in to a script so I can send it to people instead of walking them through it. It consists of two steps: ...
1
vote
1answer
177 views

Applescript enable-disable wifi Safari

I figured out a command to enable/disable wifi. networksetup -setairportpower en0 on networksetup -setairportpower en0 off Now, I was wondering how to combine it in AppleScript in a way that when ...
0
votes
0answers
28 views

Applescript to change main monitor

Is it possible to record some actions for figuring out the right applescript? I'm looking for applescript to toggle my computer from screencast settings to regular: Regular: 1. Display Time. 2. Main ...
3
votes
1answer
75 views

AppleScript Editor : comment line shortcut?

Is there a keyboard shortcut to comment lines in AppleScript Editor ? The common Cmd+shift+/ does not work here.
0
votes
1answer
158 views

How to select message in Mail with ID using AppleScript?

With the help of "Ask Different" I got my first AppleScript program working, and I'm trying to improve it. I'm again stymied though. I have found the message number ID of a particular message in my ...
1
vote
2answers
398 views

AppleScript for counting messages in Inbox fails with “Can't get mailbox”

Here is my first attempt at an AppleScript program, which met with ignominious defeat: tell application "Mail" tell mailbox "INBOX" count messages end tell end tell It compiled, but ...
2
votes
2answers
85 views

How can I automate GIF to PNG with Preview using AppleScript?

I have a GIF file but I can open it only with Preview because it is a little bit ruined (GIMP or other programs does not open it correctly but it works with Preview). I want to export it to PNG ...
1
vote
1answer
74 views

AXSelectedRows: Getting selected rows for AXOutline

I feel that AXSelectedRows has finally beaten me into submission :) After extensive research, I am stumped as to how to programmatically list the contents of AXSelectedRows; simply put, to get the ...
2
votes
2answers
101 views

How do I link/call an actual shell script saved within an Applescript app?

What's the correct syntax in the Applescript below to make this app run by double clicking on it rather than how it runs now by just running the Applescript in the AS script editor? The Shell script ...
3
votes
1answer
805 views

Save attachments from Mail.app based on subject

I have been trying to write an Applescript to help me saving attachments, but realized quickly that I do not have the knowledge to do such a difficult script. Here is some background. We receive ...
2
votes
2answers
2k views

Applescript click automation in Google Chrome browser?

Hello fellow programmers! I would like to save some applescript code as an application, so that when I open the application it will go to Google Chrome and answer an incoming call in Google Voice. I ...
2
votes
2answers
344 views

How to swap command and option modifier keys with a script in OS X Lion

I use a PC usb keyboard with my macbook. So, I've gone into System Preferences > Keyboard > Modifier Keys... and swapped command and option for the usb keyboard. This puts those keys in the ...