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
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
49 views

Moving finder window from one display to another

Would it be possible to create an AppleScript to instantly drag one screen from one screen to another (say, center of the second screen)?
2
votes
1answer
32 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
301 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
109 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
33 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
802 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
72 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
114 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
712 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
749 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
247 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
887 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
267 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
312 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
579 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
128 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
368 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
801 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
304 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
395 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
571 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
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
897 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
513 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
3answers
402 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
1answer
1k views

List of (activated) fonts with shell command in os x

Is here any shell command for getting the list of activated fonts? Mean something like: some_font_util -activated -format 'file: name' for getting a list of activated fonts in a form: ...
2
votes
2answers
520 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
25 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 ...
2
votes
2answers
29 views

Saving Applescript Removes Characters

I have written an Applescript to launch and position two instances of an Application. The script runs perfectly fine in the editor using this code: tell application "App" to activate tell ...
2
votes
2answers
44 views

AppleScript - Get the path to an application without opening it

I need to store the path to Chromium to use later in the script, however running set chromium to (POSIX path of (path to application "Chromium")) in AppleScript Editor opens the application. How can I ...
2
votes
1answer
45 views

Binding DualShock 4 button to AppleScript?

I setup a dualshock 4 (PS4) controller to work with my Mac Mini for XBMC, which can play games on emulators like SNES9x. The issue I'm having though, is that when I want to quit the game/emulator that ...
2
votes
1answer
66 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
5answers
183 views

Ejecting all network drives via Applescript/Automator/Shell?

I use the following script to attempt to eject all disks that aren't internal: tell application "Finder" eject (disks whose ejectable is true) end tell This has the advantage of skipping ...
2
votes
4answers
303 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
48 views

Is there a way to create a notification in the Notification Center with a clickable link?

I can create a notification in Applescript via display notification "Notification Text" with title "Title goes here" subtitle "subtitle goes here However is there a way when I click on the ...
2
votes
1answer
958 views

How do I focus a specific window with applescript without doing an activate and bringing other windows to the front?

I'm looking for a method w/ AppleScript to select/focus a specific window of an application without actually doing an "activate" which brings all windows to the front. Here's what I have so far: ...
2
votes
3answers
91 views

Applescript for moving recently added files (not created or modified) to another folder?

I would like to get a recent downloaded pdf file ( !: it corresponds to the Finder sort method Date Added, not Date Created nor Date Modified) and either just moving to one another folder (if using ...
2
votes
1answer
65 views

Simulate CTRL+F12 2 second keypress

Im trying to bring up the OS X shutdown dialogue box by simulating the key press Control+F12 for 2 seconds (using a logitech keyboard). No matter how much I try I just can not get it to work. My ...
2
votes
1answer
635 views

Using Hazel or AppleScript to Convert Word to PDF

I use Hazel to sort and rename files. I would like to use Hazel to automatically convert Word docs to PDF. I think this best way to do this is with AppleScript. I have searched extensively online, but ...
2
votes
1answer
113 views

How can I rename an ordered list of files with an ordered list of file names?

I have a series of files. I need to apply a series of file names. So, 001.jpg -> apple.jpg 002.jpg -> banana.jpg 003.jpg -> orange.jpg etc. I will have to repeat this for each of 16 folders with ...
2
votes
1answer
1k views

How do I give accessibility permission to my AppleScript and System Events in Mavericks?

I've got this old AppleScript that uses a mouseclick function: activate application "Safari" tell application "System Events" tell process "Safari" click at {424, 699} end tell end ...
2
votes
3answers
1k views

How to fast set hot corners in Mavericks?

I used a downloaded applescript to fast enable/disable hot corners but they don't work after I upgrade to Mavericks. Someone knows what's happening? Here's the disable script, hope it'll help you ...
2
votes
1answer
90 views

Removing only birth years from a group in my Address Book

A lot of my contacts (600+) had somehow got their birth years set to 2000. Their birth months and days are correct, but the 2000 is wrong. With the tremendous help I got here, I was able to get them ...
2
votes
2answers
811 views

Relative path in Automator

I want to make an Automator action that copies a set of files from a folder to another folder that is one folder up and then two folders down from the original files. In other words: ...
2
votes
1answer
41 views

How to test if video is local or stream?

If I watch a video in QuickTime Player, how I can test in my AppleScript, if this video file is on my Mac or is it streamed live from the net?