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

learn more… | top users | synonyms (3)

2
votes
1answer
549 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: /System/Library/PrivateFrameworks/Apple80211....
2
votes
4answers
3k 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 user@my....
0
votes
2answers
170 views

How do I save a screenshot with the ISO 8601 date format with Applescript?

I am building a script that saves many consecutive screenshots. I would like to save the files in the ISO 8601 date format.
9
votes
2answers
4k views

Any way to set/add tags on a file with Applescript under Mavericks?

Trying to move some of my scripts over from labels to tags under Mavericks, but I can't seem to find a way to set/add tags with Applescript. Anybody that know how to do this? As far as I can figure ...
1
vote
1answer
253 views

File path error in Applescript/TextExpander

I use the following code to open my dropbox folder quickly using textexpander. tell application "Finder" activate set f to POSIX file "/Users/MrT/Dropbox" open f end tell Which works, ...
0
votes
0answers
34 views

Is there a way to recognise active applications that are not being used so a script could shut them down?

Is there a way to recognise active applications that are not being used so a script could shut the down? I'd like to recognise an application that is running but has not accepted keystrokes recently ...
1
vote
2answers
2k views

How can I write an AppleScript which when run will connect to a specific WIFI network if available?

The title pretty much sums it up. I want to avoid having to use the trackpad to connect to certain networks. This comes up often when a new network becomes available but I'm already connected to ...
1
vote
0answers
380 views

Disable copy/paste for an OS X application

I would like to disable copy/paste for an app to protect sensitive information displayed in it. I don't have the app source code. I'm already aware of this general solution: http://superuser.com/...
1
vote
1answer
47 views

Move Photos from iPhone to iPad

I have to help someone do this, so I do not have the devices in front of me to play around with. There are three devices involved: Macbook (don't know what model) iPhone (don't know what model) ...
1
vote
1answer
195 views

Using AppleScript to find information about images in Pages documents

I'm trying to extract information about images placed into a Pages ('09 v 4.3) document. The following script is my attempt: tell application "Pages" tell front document repeat with pg in ...
1
vote
1answer
984 views

Start screensaver/ lock screen on screen sharing disconnect

Is there a way with an AppleScript or shell script to start the screensaver when you disconnect from a screen sharing session? For example, I connect via screen sharing from Mac A to Mac B. When I ...
1
vote
0answers
331 views

AppleScript to file attachments

I'm trying to file email attachments into a specific folder. The path is received in the subject field of the email. I'm close but not quite there. I am getting the script to run. using terms from ...
1
vote
2answers
2k views

A turning gear appears when I run this workflow, why?

I am running the following script (called Restart AppleTV) using automator : on run {input, parameters} do shell script "sudo killall coreaudiod" with administrator privileges return input end ...
2
votes
2answers
2k 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 "...
1
vote
2answers
529 views

Shell or Applescript to delay shutdown?

We have a workstation that gets used sporadically, and I'm trying to setup a script that backs it up during shutdown. I created a LogoutHook in com.apple.loginwindow to a 1-line bash script, that ...
1
vote
1answer
564 views

Launch App with Automator when system is idle

My idea is to dim the display when the system is idle for 10 seconds, and with a keystroke or trackpad activity revert to original (I want to preserve battery automatically and not using a screen ...
0
votes
2answers
977 views

AppleScript: Find all instances of “Folder” and list the contents in a drop down box/list

I'm trying to make a script I can use to find all instances of a folder, be it on the root drive, external drive or mounted networked storage, and list all the contents in either a drop down box or a ...
0
votes
1answer
288 views

AppleScript: Check if “System Events” has loaded

When an Active Directory (AD) user logs in, my AppleScript fires and attempts to put their AD home directory in the sidebar for easier access when opening and saving documents. It works great, but ...
0
votes
3answers
1k views

Run applescript as a service

I have the following applescript bundled as .app (using Platypus) and starting on user logon (12.4 MB for each user) #!/usr/bin/osascript -- INICIO DAS FUNCOES EXTRAS set app_path to path to current ...
1
vote
1answer
359 views

How to script number pad key

We use an auto login script using ARD to avoid visiting each station in our lab. Mountain Lion no longer works so that a cursor appears at the login screen. I've tried numerous scripts to activate the ...
28
votes
2answers
29k views

Run AppleScript from bash script

If I wanted to run an AppleScript from within a bash script I could call a file with the list of commands that I require to execute. #!/bin/bash {some commands} osascript file.scpt {other commands} ...
4
votes
2answers
2k views

Bash Script that will start up second Terminal process?

I need a script that will be able to fire up a second Terminal instance and pass a command directly to that one whilst it continues it's own executions. It's to start up Python script that will host ...
1
vote
1answer
190 views

POSIX path returns strange path?

I was writing some AppleScript code when I came to the following result : tell application "QuickTime Player" set paths to file of document of windows get paths repeat with theItem in paths ...
2
votes
3answers
2k 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, ...
0
votes
1answer
93 views

How can I make a .command file that I can share without giving permissions on each computer?

I have a terminal command that I would like to run. telnet 169.254.216.127 54326 Ideally I would like to convert this into a .command file and be able to share it with many other mac users ...
1
vote
0answers
247 views

Script to make the x red button kill the app

Quick background: new mac, long time windows user; not scared by linux and scripts. I am currently using RedQuits to make the x red button quit de app, not just close the window. It is a great ...
1
vote
2answers
169 views

Can SteerMouse sensitivity be automated?

I have to adjust the cursor sensitivity in SteerMouse every time I switch between my home mouse and my work mouse. Is there a way to do this programmatically?
6
votes
3answers
6k views

How can I swap the primary display automatically in a dual-monitor setup?

I have a MacBook Pro and two Thunderbolt displays at work. I work with the MacBook lid-closed because it's overkill and I don't have enough desk space anyway. Every morning I show up to work and plug ...
1
vote
0answers
76 views

Can Homebrew be used to install AppleScript bundles?

Can Homebrew be used to install AppleScript bundles? If so, what sorts of conventions would the project need to follow? Would it need to include a make.scpt file compile the .applescript files? I'm ...
1
vote
2answers
89 views

Boot straight into an application without showing the desktop

How do I boot straight into an application without showing the desktop? Essentially I would like to turn the machine on, see the grey screen with loading icon, and then see my application. The ...
1
vote
0answers
1k views

Applescript to forward email with attachment, and change subject

I'm trying to create an applescript that will take messages that match a certain filter YYYY), and forward them to a specific notebook in Evernote (XXXX), with the attachment intact. So far, I've ...
1
vote
1answer
1k views

How to write AppleScript for clicking an OK button on a custom dialog?

I have done a script to quit program: tell application "Live" quit end tell …but I get this prompt to click the OK button: I am running my Mac for schedule shutdown as it is running for an ...
1
vote
1answer
2k views

AppleScript Setting Select Drop Down

I am trying to enable dictation with applescript and so far have the following that works. But, how do I set the drop down for the shortcut key using AppleScript? Below is the AppleScript code: ...
2
votes
1answer
160 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
1answer
598 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 ...
3
votes
2answers
121 views

Cleaning up birth years 2000 in my Address Book

A few years ago (or actually, more likely, in 2000), for some reason, birthdays that didn't have a birth year (but did and do have correct month and day) were automatically given the birth year 2000 ...
0
votes
2answers
849 views

Restart OS X if an application has crashed/is not responding/beachballed?

How can I automatically restart the machine if an application has crashed in any way? It might have cleanly exited, have a quit unexpectedly error, or be frozen with the spinning beachball. I don't ...
2
votes
1answer
1k 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?
1
vote
0answers
45 views

AppleScript bundle: expose other interactive scripts?

Assuming that I've created script bundle (.scptd), is there a way to expose (for lack of a better term) other interactive scripts? Alternate scripts might preform configuration tasks or secondary ...
4
votes
1answer
702 views

Printer Deploy with and custom preset profiles to Mac OS X workstations

How would I go about deploying a network printer (Sharp MX-2600N) to Mac OS X machines that would include a custom printer preset profile (Embedded Printer User Authentication Code)? Ideal Method of ...
0
votes
1answer
648 views

Access OS X Mail message by its ID

I am trying (unsuccessfully) to get a Mail message (located in the 'Drafts' folder) by its message id. The following code: set theContent to getContent(123456) on getContent(theID) tell ...
2
votes
0answers
495 views

AppleScript to find old mail messages is slow in ScriptEditor

So I have an AppleScript that iterates over all the messages in various mailboxes and finds messages which meet various criteria and moves them to Deleted Items. The mailboxes in question are ...
1
vote
1answer
619 views

Trouble with Applescript/Xcode setting up VPN Auto Connect with Btguard's Tunnelblick Open VPN

I followed all of the all of the steps in this link How to auto connect to VPN upon login/boot?. I tried a number of times, changing the service from "BTGuard VPN" to "Tunnelblick VPN" to "BTGuard", ...
5
votes
1answer
2k views

How to click button with applescript using UI Element Inspector

I am new to applescript. I am trying to open a webpage, and click a button on that webpage. here is my script: tell application "Safari" to activate tell application "System Events" tell ...
2
votes
2answers
2k 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: ../Folder1/...
1
vote
1answer
429 views

Specify AppleScript bundle icon

I'm trying to assign an icon to my AppleScript bundle, but without success. Steps: Added the icon (applet.icns) to the bundle's /Contents/Resources directory Modified the bundle's /Contents/Info....
2
votes
1answer
2k views

Find Record with List by key in AppleScript

Is there way to get a Record by the value of one of its keys without looping? I've been doing this: set theKey to 22 set theRecords to {{key:11, value:"foo"}, {key:22, value:"bar"}} repeat with ...
2
votes
0answers
144 views

AppleScript deployment conventions?

I haven't seen a package-management system for AppleScripts, but it seems like the foundations for one are present. Given: Scripts (and folder) located in the ~/Library/Scripts/Applications folder ...
1
vote
0answers
58 views

Is there another way apart from screencapture to take a screenshot of a background window?

I'd like to take a screenshot of a background window given its title. I know this can be made with screencapture -l idwindow output but unluckily I can't use this method because I'm on a 10.5.8 ...
1
vote
3answers
8k views

Get components (path and filename) of POSIX filepath

Given: ~/Desktop/Foo.scpt contains: (POSIX path of (path to me)) as text Which returns: /Users/[username]/Desktop/Foo.scpt How do I get path /users/[username]/Desktop/ and the file name Foo....