AppleScript is a proprietary programming language in Mac OS X to control and exchange data with applications.
29
votes
3answers
12k 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 ...
11
votes
1answer
642 views
How do I make an AppleScript file into a Mac App?
I have an Applescript that simply opens a Dialog Box, asks for a user input and runs a Terminal Command and spits out the answer. It works great in AppleScript Editor yet I am trying to work out how I ...
10
votes
3answers
2k views
How can I “say” to another Mac?
I have two Macs in our house (iMac and MacBook Pro).
I would like to use the say command-line utility to type something on my MPB and have it speak on the iMac, rather like an intercom system.
Plus, ...
10
votes
6answers
4k 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 ...
9
votes
5answers
1k views
Is there a bash command to check to see if Time Machine has finished backing up?
I'm writing a script that will rsycnc my Time Machine directory to a remote server using ssh. I've switched from a shell script to an AppleScript and then back to an Apple script and I don't really ...
9
votes
5answers
1k 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)?
9
votes
2answers
2k views
How to change AppleScript path to a Terminal-style path?
I have a custom Service that I've created in Automater (I'm on OSX 10.6.5). The Service executes an AppleScript which in turn executes a shell script. Here is the AppleScript:
on run {input, ...
8
votes
8answers
3k views
How to retrieve current wattage info on OS X?
Is there a way to retrieve the current watt usage info on OS X Snow Leopard? I'm using mid-2010 iMac, so I'm not looking for just battery-related apps.
Does OS X even monitor power usage? Do I need ...
8
votes
2answers
2k views
Automatically delete a folder daily
Is there a way to automatically have a folder deleted every day at 4am?
I'm running 10.6.7.
8
votes
3answers
449 views
How can I make an AppleScript activate upon logging in?
Is it possible to force an AppleScript to activate when I log in?
8
votes
3answers
5k 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 ...
8
votes
4answers
518 views
Copying formatted text from a web page to an Applescript input dialog
I have an Applescript which - simplified - looks like this:
...
display dialog "foo" default answer ""
...
One of the users of this script runs Lion. Whenever he tries to copy/paste a string to the ...
8
votes
3answers
489 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
...
7
votes
4answers
2k views
AppleScript vs. Bash script?
I'm a long-time Windows "power user" and developer who has recently decided to move over to Mac OS X.
On OS X Lion and indeed previous versions there seem to be two main options for scripting and ...
7
votes
3answers
7k views
How do I open Google Chrome in Incognito mode by default
Is there any way (using apple script or by using settings on chrome) to open Google Chrome in incognito mode.
7
votes
4answers
1k views
Sending push notification to iPhone via AppleScript
Is there any combination of iPhone and/or Mac apps that I can use to send a push notification to my iPhone?
For example, let's say I want to create a service (invoked via (Application Name) > ...
7
votes
4answers
976 views
Creating an automated HFS+ compressed folder
I would like to set up an automated way for archiving files in OS X Lion. By archiving I mean using HFS+ compression feature on a specific folder, and make every file that I move into this folder ...
6
votes
1answer
309 views
Simple auto-typer with AppleScript
I want to make a small application that will type the number 1, wait an interval, type the number 2, wait an interval, type number 3, wait an interval, etc.
This works for typing one number over and ...
6
votes
2answers
319 views
What's the easiest way to automate logging into a website?
There's this website I need to access about every ten minutes. And apparently it was designed in 1993, by sadists. There is no "remember me on this computer" checkbox. And if you don't interact with ...
6
votes
1answer
152 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 ...
6
votes
3answers
154 views
How to add folder to Spotlight “do not index”?
Is there any way to programmatically add a folder to Spotlight's "Privacy" tab?
Either through Terminal or Applescript?
Often I want to click on an item in Spotlight results in Finder, and have that ...
5
votes
1answer
1k views
Is there a way to force Mac OS X to close all the applications when restarting?
I sometimes shut down my Mac, and I cannot wait it shuts down because I am urgently requested to do something in another office that would require some hours. In some cases, an application that opens ...
5
votes
2answers
2k views
Is it possible to restart an application using AppleScript?
I want to restart Safari and reopen it with some tabs that I specify.
5
votes
1answer
7k 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 ...
5
votes
4answers
4k views
How do I make an AppleScript with a drop-down menu without Xcode?
How do I make an AppleScript that displays a drop-down menu without using Xcode?
5
votes
2answers
899 views
Is there a fast way to change proxy setting?
On my laptop I usually have a ssh connection open and use the remote machine as a proxy server just so that all my network traffic is over ssh. I know that it's hopeless and we're all doomed, but it ...
5
votes
2answers
530 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 ...
5
votes
1answer
304 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 ...
5
votes
3answers
916 views
Automatically quit Terminal when typing exit
Scenario
I use terminal to SSH a lot, however would like the Terminal App to quit when the last Tab closes using exit. I already have the terminal window itself set to close on successful exit, ...
5
votes
1answer
458 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 ...
5
votes
1answer
1k views
Command-line voice recognition with Mac OS X
How can I do voice recognition on Mac OS X from the command line? Details:
% When I look in ~/Library/Speech/Speakable Items, I see many files,
like "Tell me a joke", whose contents are:
...
5
votes
1answer
296 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 ...
5
votes
3answers
1k views
Where is the date and time preference data saved on Mac?
I need to check programmatically whether Set Date and Time automatically is checked or not on a Mac System Preferences.
I didn't find any .plist file that contained this information, can anybody tell ...
5
votes
1answer
304 views
How to Listen For an Application Launch Event on Mac OS X
I wrote an AppleScript to mount a bundled sparse disk image. I want this script to be executed exactly when Time Machine launches.
I can check if Time Machine is running with on idle statement,
on ...
5
votes
2answers
424 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 ...
5
votes
2answers
412 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 ...
4
votes
3answers
209 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 ...
4
votes
2answers
306 views
Where can I access official AppleScript documentation?
Is there any official AppleScript documentation? If so, where can I find it?
4
votes
1answer
5k views
Where did “URL Access Scripting.app” go in Lion?
I have AppleScripts that run on a schedule to download files from URLs. They had been using URL Access Scripting.app's download event, which now looks to have disappeared from Lion.
I can't find any ...
4
votes
1answer
82 views
How do I close the source of an AppleScript application?
When saving an AppleScript as an application, you can view the source by looking in the package contents. Recently, ruddfawcett posted his AD search application he made with AppleScript and the source ...
4
votes
2answers
2k 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 ...
4
votes
3answers
1k views
Change the default application (for a file extension) via script/command line?
Is there a way to define the default application for a file extension via an Apple script, command line command (like defaults write [...]).
I know that you can change it manually via the information ...
4
votes
5answers
796 views
How can I remove leading/trailing whitespace from filenames in Automator?
My wife tediously renames files all the time when storing on her backup external storage, so I investigated using automator to do this for her. I now have an automator folder where she just drops the ...
4
votes
1answer
2k views
Is there an Automator action to create Keynote presentation from text file?
I need to import a text file (consisting of subtitles) into a Keynote presentation. I need to turn each subtitle into a single slide, interspersed with blank (black) slides. I'd like to create an ...
4
votes
2answers
923 views
OS X - AppleScript Question about moving files daily to another folder (folders vary)
I am currently using this ( http://lifehacker.com/193778/download-of-the-day--auto+applescript-tickler-file ) for a tickler file system and have it setup in my Dropbox (so it works across systems). ...
4
votes
1answer
1k 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"
...
4
votes
1answer
158 views
How to register an AppleScript as a potential default web browser?
I've written an AppleScript that I want to set as the default browser.
I've added a CFBundleDocumentTypes section to the p-list (copied from Safari) and rebuilt the launch services database, but that ...
4
votes
1answer
453 views
How can I automatically download multiple sites through Coda?
I have several sites in Coda that I would like to automatically re-download when I tell it to. The sites are collaboratively managed, and I'd like to download a fresh copy of the sites automatically. ...
4
votes
1answer
1k views
Run Command Line Script from Finder's contextual menu
I have a shell script that deletes exif data from images.
I would like to right-click the folder with the images and execute the command from the context menu. How can I do this?
The Shell script ...
4
votes
1answer
123 views
Execute a custom script when OS X 10.8 is in Power nap?
Apple new feature of OS X 10.8 in new Macs "Power Nap" checks email and does make backups.
Is it possible to execute a custom script (bash, AppleScript,...) when OS X 10.8 is in Power nap mode? For ...
