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

learn more… | top users | synonyms (3)

1
vote
1answer
109 views

How to start a service automatically after openning an application?

For example, I have a service that I want it to be started automatically when I open Firefox. I know how to write scripts as services in automator, but I don't know how to make a hook that when ...
1
vote
2answers
467 views

Automatically move files into correct folder on server

I often need to move files from one location on a server into a set of hierarchical folders. The filenames are usually 7 digits long - sometimes with some extra characters at the end. The folders ...
0
votes
1answer
408 views

Programmatically read both per-tab Terminal.app titles

When bringing up the Inspector (⌘I) in Terminal.app to edit the title (⇧⌘I), there are actually two titles that can be entered. The first is known as the Tab Title and affects the terminal window ...
0
votes
1answer
195 views

Script to Update/download most recent iTunes podcast WITHOUT opening iTunes at all?

I have a couple favorite podcasts that I subscribe to in iTunes. I'm using You Control (so I don't have to open iTunes to play my music). I'm using Keyboard Maestro. I've made a macro that runs ...
4
votes
1answer
290 views

Any way to write the Terminal scrollback history?

I would like to open a new tab in Terminal with custom scrollback history. The primary use-case is to "fork" an existing tab such that both tabs contain the same scrollback history, but more generally ...
1
vote
2answers
4k views

How can I get certain types of files dropped in certain folders based on file type?

I was wondering if it is possible to have the following: In my Downloads folder, I have 2 subfolders : IMAGES and VIDEOS. Is it possible to automatically move every image downloaded to the Downloads ...
0
votes
2answers
3k views

Applescript to add sender of message to specific group in Contacts

I'm trying to set up an Applescript to add the sender of a selected message in Apple Mail to a specific group in the Contacts app. By reconfiguring the code provided in this answer, I worked up the ...
0
votes
1answer
6k views

Automatically Save Attachments in Mail.app in 10.8 Mountain Lion

I am trying to automatically save all email sent to one address (let's call it test@example.com) to this folder /Users/luomat/Dropbox/Incoming/e2w/ (where /Users/luomat = $HOME). Here is the rule ...
0
votes
1answer
87 views

Turn on iTunes EQ via AppleScript

Can I turn the iTunes EQ on/off using AppleScript? I found a way to change the preset, but not turn the EQ on or off.
2
votes
1answer
264 views

Safari - menu to show live tabs open in open windows

I often have five or six Safari (and Chrome) windows open, each containing several tabs. I often lose track of where a live tab is when I want to return to it. I can use the Safari window menu option ...
1
vote
2answers
2k 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
1answer
3k views

How to initiate a specific keystroke using automator?

I have the following code : on run {input, parameters} if application "KeyboardViewer" is running then quit application "KeyboardViewer" else activate application ...
-1
votes
1answer
448 views

Applescript opens new window for everything when run

I have the following code I did for a tweetbot keyboard shortcut to open tweetbot and create a new tweet. on run {input, parameters} activate application "Tweetbot 2" tell application ...
1
vote
1answer
480 views

How to start an app in the foreground?

For some reason, gitk always starts under all other apps. How to make it start on top of all other apps, like a normal program? Start it from the terminal with the gitk command, which lives in ...
1
vote
1answer
224 views

F.lux does not always work on resolution changes. Is there a way to check if the resolution changes?

I'm a happy user of f.lux, but sometimes when I plug in my external monitor on my macbook air it returns to full brightness. This also sometimes happens if I unplug my external monitor and switch to ...
2
votes
1answer
416 views

How to replace images in iPhoto with higher quality versions?

I use Aperture for photo editing and processing, but prefer iPhoto for keeping a gallery of my pictures. For a long time, I used the built-in tools in iPhoto to "Import from Aperture Library". What I ...
3
votes
0answers
306 views

Applescript vs. Spaces in Lion (10.7)

In Snow Leopard (10.6), I had an applescript that toggled iTunes between "maximised on Space 2" and "mini-player on all spaces": set app_identifier to do shell script "echo 'com.apple.iTunes' | ...
2
votes
1answer
350 views

Can I run a program whenever I open the lid of my MacBook Air? [duplicate]

Possible Duplicate: Run AppleScript after waking from Sleep? I have a program, InstantShot!, set to launch at logon and start taking a screen shot every 10 seconds. Unfortunately, when I ...
4
votes
3answers
627 views

How can I make this Apple Script shorter? (quitting multiple apps via tell)

I want to edit a part of an Apple Script to quit various applications at once: tell application "TweetDeck" quit end tell tell application "Google Chrome" quit end tell Over all there are ...
0
votes
4answers
660 views

Pressing the control key with AppleScript

I use Voice Over and Dragon Dictate. I have figured out how to make Dragon Dictate press Control-Option-A, which makes Voice Over read a page of text, and now I would like to figure out how to tell ...
1
vote
2answers
2k views

How to check which files are not in iTunes library, but are in iTunes folder?

This is a question from Wil Wheaton's google+, but I would like to get an answer too, stackexchange style. Suppose you have all your music in a folder called /iTunes/Music. When you add files to ...
0
votes
2answers
278 views

How do I copy the location of a track to the “Comments” section in iTunes?

I dont understand why this is not working. If anybody knows how to resolve this issue: tell application "iTunes" copy location of track 1 of playlist "Test" to Comments end tell Applescript ...
0
votes
2answers
608 views

Display a notification with AppleScript

I would like to trigger a notification with AppleScript. I have seen How can I trigger a Notification Center notification from an AppleScript or shell script? but I would like to have a native ...
3
votes
1answer
299 views

AppleScript/Automator Workflow to restore OS X to “mint” condition

Under Mountain Lion, I wanted to create an AppleScript that would essentially restore my OS X install to "mint" condition, if possible even to the point of showing you the ML welcome screen asking you ...
2
votes
2answers
565 views

How can I reproduce the Finder sort order without asking Finder to sort for me?

I work with a large collection of mostly-text files subdivided by series, periodically mirroring them from an upstream repository and repackaging them using a shell script from a slightly chaotic ...
5
votes
2answers
3k views

Using applescript, how to move a window to my second display?

I have experimented with absolutely every possible scripting option I can find on the web, and no matter what I do I cannot move a FaceTime window to my secondary display. This works... tell ...
8
votes
3answers
2k views

Copying files to the clipboard using applescript

Often I find myself at the command line wanting to copy files to the clipboard, so that I can paste them as attachments in Mail. If I have an image file, image1.png, I can accomplish this with ...
1
vote
2answers
420 views

How to suppress the “Run or quit” dialog when launching an applescript?

I am having the same basic problem as in this question: AppleScript app started prompting to run or quit. How can I disable this? However, in my case the "Startup Screen" option is definitely NOT ...
0
votes
1answer
317 views

Set Specific Podcasts to Show as TV Shows in iTunes, using AppleScript

I'm using on online TV recorder to record TV shows. Those recordings are downloaded as a podcast to iTunes. My following Applescript should just grab those podcasts, update some info fields and ...
4
votes
2answers
2k views

Why does this applescript not actually set the input volume to zero?

I have this command that builds a script to mute the input volume. The input volume is not fully muted, though. It seems to be closer to 10% than 0%. osacompile -x -e 'tell application "System ...
3
votes
1answer
458 views

Applescript - Connection is invalid

I have an application for mac and I use the following applescript code (exported as an AS app) to start that app periodically: on idle tell application "System Events" tell application ...
1
vote
1answer
624 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, ...
1
vote
1answer
195 views

How to run Excel on headless Mac?

I'd like to run applescript to control Excel on a headless Mac. I want to do it from the command line via ssh, and I cannot - there is no display to run applescript on, so osascript throws an error. ...
1
vote
1answer
948 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 ...
2
votes
1answer
748 views

Applescript to turn off Mission Control in OS X 10.7

I found most of the below on https://discussions.apple.com/thread/3046230?start=0&tstart=0, but I believe it relates to OSX10.6 (or earlier) given that Mission control seems to have replaced ...
4
votes
1answer
4k views

Using UI scripting to enter text in a file dialog

I am very, very new to using AppleScript. I need to enter text into the search box. So far the script looks like this: on run {input, parameters} tell application "myApplication" to activate ...
3
votes
1answer
629 views

Can I send Notification Center items to my iPhone using Pushover or Prowl?

The title pretty much sums it up. I often feel like having notifications on my iPhone are a lot easier to notice, especially if you step away from the computer for a few moments to do something and ...
2
votes
2answers
4k views

Can Applescript be used to automate a screen recording session on OS X?

I need to accomplish the following tasks from a script: Initiate a screen recording (with system audio). After a set delay, stop the recording. Save out to a file. Close the recording. I've tried ...
1
vote
1answer
2k views

How to create new message in iChat without sending, using Automator to grab selected text

I am trying to create a service that grabs the URL of some link, then create a blank iMessage with that URL in the body. Basically, I want to recreate that Message share feature in Safari in Mountain ...
4
votes
2answers
858 views

Is there a sane way to emulate the newer media key behavior completely on an Apple Extended Keyboard II?

The operative word here being "completely". I recently found a nearly flawless (cosmetically and functionally) AEKII (Alps, not Mitsumis) on eBay and won it for $30. It's an awesome keyboard and it ...
0
votes
1answer
669 views

Script to turn flagged emails into reminders

I am looking for a script that will recognize when an email is flagged and then turn it into a Reminder using the Reminders app.
6
votes
1answer
366 views

Any way to get the “Open With…” list via AppleScript?

I want to create an AppleScript that gets the Finder selection and displays a list of applications that are capable of opening it. In other words, is there any way to get the list of apps that ...
2
votes
1answer
218 views

AppleScript SL to ML Issue (compatibility error?)

I've written the following script in Applescript in Snow Leopard, and I tried to use it in Mountain Lion, but to no avail (doesn't work). The script watches a folder for added files, and if the ...
1
vote
2answers
2k views

Change Date Created based on the filename

I've downloaded a bunch of my Instagram images but the Date Created of the files is set to the time that I initiated the download. What I do have though is the Date Created in the filename. What I ...
0
votes
1answer
394 views

Detect the TV Show, Season and Episode from a mp4 file in applescript

Assuming I have an MP4/M4V file of a TV show. The file has the necessary metadata so it can be imported into iTunes and you'll see the all the relevant information. Using AppleScript, one can extract ...
1
vote
1answer
1k views

AppleScript to compare contacts in two groups and remove duplicate from one group

I want to create an AppleScript for Apple's Address Book (Contacts) app that will look at two Groups, and if a contact is in one Group, it will remove it from the other Group. Specifically, I add ...
1
vote
1answer
1k views

Insert images into Pages document using AppleScript

I'm trying to automate the construction of a document, and am looking for a way to insert images into a Pages document with AppleScript. For example: tell application "Pages" make new document ...
3
votes
1answer
2k 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 ...
2
votes
3answers
7k views

How do I create an AppleScript that will quit an application at a specific time and then put the computer to sleep?

I've been toying around with AppleScript and Automator to get this thing to work, but I just can't seem wrap my head around it. If anyone could show me an example or give me some tips on how I can set ...
6
votes
1answer
764 views

Toggle Finder sort order with AppleScript under Lion 10.7?

For years I've been using this AppleScript to toggle the sort order of a Finder window: if sort direction of column id size column of list view options of window 1 is normal then set sort ...