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

learn more… | top users | synonyms (2)

2
votes
2answers
143 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 ...
2
votes
2answers
138 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 ...
2
votes
3answers
604 views

Applescript for deleting desktop files upon logout

I'm completely new to Applescript and currently very busy at work. I don't have time to learn it, I will once I find some free time, so I decided to ask you, the experts, for help. I need an ...
2
votes
2answers
654 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 ...
2
votes
3answers
390 views

Automator: Correct syntax for calling an AppleScript file

I'm attempting to write an Automator application that will mount an external disk. I have an AppleScript that does the job and I'm attempting to insert it into an Automator application. However, ...
2
votes
2answers
127 views

Add AppleScripts to Git repository

I have a few AppleScript files that I would like to share with the community on GitHub. The files are located in two distinct directories: ~/Library/Scripts ~/Library/Application ...
2
votes
1answer
1k views

Set size of window to exact pixels, and place via x, y coordinates

I would like to create a tool that allows you to set windows to exact sizes on the pixel scale to be able to have more precise screen divisions. For example, if I had four Terminal windows (and I ...
2
votes
4answers
250 views

How to get screenshot only external monitor?

I there any way to screenshot only external monitor screen? do shell script "screencapture -x " & shot_path
2
votes
3answers
283 views

How can I set up a shell script as a wrapper to the main executable of an app?

I have an application that I want to launch via a shell script that does some setup and then launches the app itself with some specific options. Ideally, this script would be run whenever the ...
2
votes
2answers
943 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 ...
2
votes
3answers
510 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 ...
2
votes
1answer
475 views

What are some good resources for learning how to AppleScript with Xcode 4.3.2?

I AppleScript quite a bit and I'd like to start working with Xcode 4.3.2, so that I can expand the functionality of the things I'm writing. However, I have no idea how to use Xcode, nor how to ...
2
votes
1answer
453 views

Can you (semi-)automatically rate all songs with at least X plays with Y stars in iTunes?

After reconsolidating my music collection in iTunes, I’m curious if there is any way to programmatically set star ratings based upon the number of plays, but only for songs that I have not yet rated? ...
2
votes
1answer
946 views

How Can I Restart in Windows Using a Script?

I'd like to be able to reboot into the Boot Camp partition without needing to go change the Startup Disk in System Preferences or holding down the Option key at startup. After reading some stuff on ...
2
votes
2answers
3k views

How do I use Applescript with Keynote?

My first Problem: For some reason the Applescript Editor is not able to pick up events when recording from Keynote'09 (I already turned on the acessibility options). The Editor stays blank for all ...
2
votes
1answer
352 views

Force a file to overwrite instead of appending

I've got an application that won't overwrite a file with the same filename. It will only append the filename with a 'space 1'. If I write a file more than once I get something like this: ...
2
votes
2answers
1k views

AppleScript or Automator Workflow for Bulk-Converting Powerpoint Presentations to Keynote

I have a large set of Powerpoint presentations that I would like to convert to Keynote. I can convert each one manually by following these steps: In Finder, right-click Powerpoint document and ...
2
votes
1answer
1k views

How to use the built–in VPN Server on Mac OS 10.6.6

I know that Mac OS 10.6.6 has a built in VPN server that one can access through command line. Is there an easier way? Can I make an Automator or AppleScript program that starts and stops the built–in ...
2
votes
1answer
36 views

In an AppleScript, how do I call/reuse a subroutine from another AppleScript?

snippet 1a on removeText(searchText, sourceText) set prevTIDs to text item delimiters of AppleScript set text item delimiters of AppleScript to searchText set sourceText to text items of sourceText ...
2
votes
2answers
1k views

Passing a password to an Automator application

I have written an Automator application with the following shell script to open an FTP connection on my system: sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist osascript -e 'tell ...
2
votes
4answers
953 views

How to open a new Terminal tab in current working directory?

I want to create and run a bash function that: cd into a project's directory Open a new tab in Terminal in the same directory Open my dev tools and start dev services Item #2 doesn't work as ...
2
votes
1answer
273 views

Trim filenames in automator w. shell or applescript

Why doesn't this work? (The automator is in swedish but the parts are: get selected finder objects - get folder contents - run shell script) I want to trim the first three characters of the ...
2
votes
1answer
42 views

list box in applescript?

I'm trying to have users pick a department from a list box. And then that choice is stored in a variable as string. How can I do this? I have code written like this: set deptList to {"dept1", ...
2
votes
1answer
682 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
1k 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. ...
2
votes
1answer
75 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 ...
2
votes
3answers
148 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, ...
2
votes
1answer
84 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
921 views

Run script before restart/shutdown

Is it possible to execute a script/command right before OS X is shutting down or restarting? I'd like to run sudo apachectl stop to stop apache from auto-starting.
2
votes
1answer
1k views

Change the icon of an applescript-called notification

With OSX Mavericks we now can make notifications with applescript pretty easily. However, there doesn’t seem to be a way to change the icon that appears to a custom one. Is there a way to accomplish ...
2
votes
1answer
295 views

Check for Existence of File then Move Rename Old File and Move New One

Here is what I am attempting to do: I have a folder which contains a script and a file. The file is an older copy of a file located in this path: ...
2
votes
4answers
1k views

osascript “set bounds of window” not working after Mavericks upgrade

I have a number of bash functions I run at the beginning of each day to start work. They all look pretty much like this: mind() { osascript -e 'tell app "Terminal" do script "ssh -A ...
2
votes
1answer
270 views

How can I change Contacts.app custom labels automatically using AppleScript?

Is there a way to change the current labels in Contacts.app to custom ones using AppleScript based on a specific criteria? Here is what I mean: I need the script to go through my contacts to change ...
2
votes
1answer
358 views

Launch Dictation With Applescript

I would have thought this would be easy to find, but thus far it has not been for me. Is there a way to launch dictation (fn, fn) with applescript or from the terminal?
2
votes
1answer
41 views

How can messages be scripted whenever I open a specific application?

Say I want to start Safari on my Mac. Can I create a pop up message that reads, "Use Chrome instead" or some other thing? I presume it may be possible with Applescript or something, but don't know ...
2
votes
2answers
349 views

Applescript to run when iPhone connects/disconnects

I'm trying to figure out how to run an applescript when I connect and disconnect my iPhone with the USB cable. So far, I think I can run an applescript when it connects by using Image Capture ...
2
votes
1answer
1k views

Automatically forward “Starred in Gmail” messages to OmniFocus

Summary: I would like to create some sort of an automated process where any messages that I 'star' in Gmail (aka 'flag' when using Gmail via IMAP) will automatically be added to OmniFocus, and then ...
2
votes
1answer
757 views

What techniques work to handle errors in AppleScript so I can place a dialog?

I'm new to programming and AppleScript and I have lots of problems with error handling. Could anybody share their error handling for file operations like move/trash files? Here is my code so far: ...
2
votes
1answer
172 views

How can I script Preferences changes in an application?

I want to use applescript to change a checkbox in the preferences box of Safari. I can open the preference window, but how to code the check box change? Example: I'd like to toggle the check box for ...
2
votes
2answers
418 views

Inconsistent results when getting folder size in AppleScript

I'm using this line to get the size of a folder: set thesize to physical size of folder x The problem is that sometimes it works, other times it doesn't, and it's very annoying because there ...
2
votes
1answer
338 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 ...
2
votes
2answers
472 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 ...
2
votes
1answer
618 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 ...
2
votes
3answers
636 views

How to add a Safari toolbar button that runs an AppleScript

How do I add a button to the Safari toolbar that, when clicked, executes a given AppleScript?
2
votes
1answer
2k views

Is is possible to format an Applescript dialog?

I am writing an AppleScript and I'd like to be able to format text in a display dialog box. For instance, I want part of the text to be bold or italic. How can I do this?
2
votes
1answer
942 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 ...
2
votes
1answer
4k 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 ...
2
votes
1answer
546 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 ...
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
3answers
435 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 ...