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
126 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
238 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
278 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
3answers
505 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
472 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
447 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
936 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
350 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
35 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
896 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
1answer
108 views

Is it possible to submit not sandboxed app to the Mac App Store

I have an AppleScript Cocoa application that does a lot of shell scripts like kill or chflags. Is there any way I can try to send it on review to MAS and get it approved? According to Wikipedia: ...
2
votes
4answers
844 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
204 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
40 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
611 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
137 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
2answers
863 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
285 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
258 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
331 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
340 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
704 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
154 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
400 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
2answers
896 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
1answer
325 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
442 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
604 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
609 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
927 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
3k 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
535 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
429 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 ...
2
votes
2answers
535 views

How can one invoke a keyboard shortcut from within an AppleScript?

I need to invoke a keyboard shortcut from within an AppleScript code, later to be used as a startup item (i.e. the alternative to having to press something at every log in).
2
votes
1answer
36 views

Applescript question for copying files

I wrote a script to copy files from an SD Card to a Thunderbolt Hard Drive. I wanted the action to automatically do all of this in a single shelled applescript under an automator action. When I ...
2
votes
2answers
58 views

Run an AppleScript that requires keystrokes while the screen is locked?

I've got a very simple AppleScript whose job it is to type some words into a text box. tell application "TextEdit" activate end tell delay 0.2 tell application "System Events" keystroke "Hello ...
2
votes
1answer
42 views

Exponential Slowdown of Applescript

So I've been working on a simple AppleScript to try to help with managing my e-mail in OS X's Mail, and I have it seemingly working just fine with one major problem; the performance of the script is ...
2
votes
1answer
43 views

How to automate changing the settings when you connect the mouse?

I want to change option in System Preferences "Scroll direction: natural" every time I plugin mouse to my MacBook. And switch back when mouse is disconnected. This should happen automatically. How ...