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

learn more… | top users | synonyms (2)

0
votes
4answers
575 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
1k 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
229 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
572 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
287 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
508 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
1k 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
370 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
276 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 ...
3
votes
2answers
1k 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
418 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
562 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
178 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
818 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
650 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
3k 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
589 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 ...
1
vote
2answers
3k 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
3answers
747 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
589 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
329 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
213 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
352 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
981 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
946 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
5k 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
662 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 ...
0
votes
2answers
452 views

How to get the path of the selected Image in Adobe Bridge via Applescript?

I am trying to get the parent file path of a selected image thumbnail in Adobe Bridge CS5.1 to pass it on to a shell script. An Applescript wraps a tiny javascript command in command like this: set ...
6
votes
3answers
2k views

How to disable individual USB ports by script?

I am looking for a script which will allow me to disable one specific USB port on my Mac mini. It would only serve a purpose if it works in real-time and didn't require a reboot. I've found scripts ...
0
votes
2answers
527 views

How can I connect Linux server with Applescript using iTerm or Terminal?

I want to connect and run bash script on Linux server automatically by using Applescript and iTerm or Terminal on OS X. How can I connect Linux server with Applescript use iTerm or Terminal?
0
votes
1answer
476 views

Drag and drop from iPhoto may remove the pictures from iPhoto Library, how to recover it?

I modified the "Recursive Image File Processing Droplet" example provided from Apple in AppleScript Editor to rename any dropped file and move it to a custom folder. It worked seemingly flawlessly ...
9
votes
3answers
9k views

iCal No Longer Runs Scripts?

I have some automated tasks in the form of AppleScripts which I would schedule to run overnight via an iCal event. The event would simply be set to "run script" at "0 minutes before the event" and ...
12
votes
6answers
11k views

How to set screen resolution with a keyboard shortcut on Retina MBP?

I've found myself switching between the 1440x900 and 1920x1200 "effective resolution" setting depending on what I'm doing (need more space on screen, etc). Is there a way to toggle between these two ...
2
votes
1answer
1k views

Why won't my AppleScript run as a Service?

I have a simple AppleScript that works exactly as expected when run on its own, ether as an app, directly from within ScriptDebugger or Script Editor, or as an element of an Automation from within ...
1
vote
1answer
661 views

How do I change some text in an OmniGraffle document via AppleScript without changing the text's styling?

If I create an OmniGraffle document, add a text box with “Test” in red in size 28, I can change the text with this snippet of AppleScript: tell application "OmniGraffle Professional 4" set text ...
0
votes
1answer
104 views

Applescript won't play movie when waking from sleep

I have the following AppleScript, which is triggered by iCal to act as my alarm clock: set musicPath to the path to me as text set musicPath to text items 1 thru -12 of musicPath as text set ...
7
votes
2answers
5k views

How can I bring a window to frontmost without focusing it using Applescript in OS X 10.8

I want to bring a window (QuickTime for example) to frontmost, without focusing it. I can do it in OS X 10.7 using the following code in Applescript. tell application "System Events" set visible ...
0
votes
1answer
999 views

Trying to use applescript to launch cmd line 3 scripts in new tabs

I'm trying to launch 3 tabs and run a script in each with applescript. So far I havent been able to get this done. Currently I have: tell application "Terminal" activate do script "ping ...
1
vote
2answers
2k views

How do i pass variables' values between subsequent applescript runs? (persistent value between script executions)

I have an applescript that I run like a cron job. Within this applescript, i have variables that act like boolean switches (i.e. on/off values). With subsequent runs, depending on whether the boolean ...
5
votes
3answers
5k views

Activating screen saver from AppleScript in Mountain Lion

I had a script that I used to use to activate my screen saver, and it no longer works in Mountain Lion. It was a shell script that called an AppleScript script: #!/bin/bash osascript ...
3
votes
1answer
578 views

Does applescript's 'delay' function work when the computer is asleep?

I'm trying to make an alarm clock for myself with AppleScript after my old (physical) one crapped out. I've got a script that'll schedule a pmset wakeup at the requisite time. There's just the matter ...
76
votes
5answers
34k 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
367 views

AppleScript to tell Adobe Reader to close a certain document

Adobe Reader has N documents open. One of them has a known filepath and title and it needs to be programmatically closed. How to go about doing this in AppleScript? Specifically, how can I: Talk to ...
0
votes
1answer
157 views

Applescript to monitor terminal changes

I want to be able to check if a word appears in a terminal window running a java application and then display a notification. Any ideas?
3
votes
1answer
402 views

Finder list view, change column with to optimal with using AppleScript

I'm trying to create an AppleScript script that resizes the columns of Finder's list view (e.g. Name, Size …) to their optimal width (i.e. the minimum width where all text in the column is visible) on ...
3
votes
3answers
530 views

How can I see how long my computer has been active (as in not idle)

I've seen a variety of solutions to check how long my machine has been idle, and I know I can check how long since last reboot with uptime, but I'm curious if there's a way to see how long since my ...