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

learn more… | top users | synonyms (3)

5
votes
2answers
4k views

Automating ffmpeg using Automator Service

I often use ffmpeg off the command line to convert video files into mp4 on my Mac (running Mavericks). Do note, however, that I am NOT re-encoding my videos; am just changing the container from an avi ...
1
vote
0answers
17 views

Automating VPN switching

I can us a VPN app like tunnelbear to appear to be in other countries, but is there a way to do this in a bash script or applescript? I want to be able to run automated tests on my iOS apps (in the ...
1
vote
0answers
25 views

AppleScript, Mail, & Outgoing Message Visibility

Here's a simple AppleScript for creating and sending messages. tell application id "com.apple.mail" repeat with i from 1 to 5 set newMessage to make new outgoing message at ¬ ...
11
votes
6answers
4k views

look up a word in Dictionary.app in Terminal

Is there a bash or applescript to look up a word in /Applications/Dictionary.app from a Terminal window ? open -a /Applications/Dictionary.app/ --args word ignores --args, says "type a word to look ...
1
vote
2answers
548 views

Why AppleScript in El Capitan runs differently?

Why in El Capitan this app says 3 1 2? Before El Capitan it said 1 2 3. When this script is double clicked, it needs to say 1 2 3. on run say "1" testing() end run on testing() say "2" end ...
1
vote
2answers
141 views

Batch download URLs from a .txt file

I have a .txt file with URL's on a separate line. http://www.apple.com http://www.google.com http://www.reuters.com I would like to download these webpages as a page source (a .html file) so I can ...
2
votes
1answer
50 views

Change Copy and Paste behaviour system-wide

I would like to enhance the global copy/paste behaviour with an additional action. In particular, I often use Growl to display custom notifications. From the command line, I can use the growlnotify ...
2
votes
1answer
26 views

Launch different apps based on file name (other than the extension)?

I'd like to have different apps handle .jpg files based on a naming convention I'll use for the .jpg files. Specifically most will go to Xee, but ones containing thumb should instead cause VLC to be ...
1
vote
0answers
57 views

Copying a path of the app to a new directory?

I was wondering if someone could help me make an AppleScript that copies the app the script is into another location. So, this is what I tried... (Please don't say anything since I am new at ...
0
votes
0answers
22 views

How forward email attachment as new email?

Each day an email is received from a specific sender with a pdf. That pdf then is to be sent as a new email with no history of the previous sender. Any ideas how to do this?
1
vote
1answer
109 views

Controlling audio output's sample/bit rate on OSX from command prompt

Is there a way to limit the output format of a soundcard on OSX, apart from Audio MIDI Setup? I have noticed that OSX has a bad habit of resampling audio while it is not needed at all (say the output ...
2
votes
1answer
1k views

Turn Wifi off/on with a single key?

Is there a way to assign the WiFi on/off function to one of the function keys like F4 that I otherwise never use? I assume Applescript would be required. However I may want to use a BASH script ...
0
votes
0answers
57 views

Import .ics files programmatically

If I have one or several .ics files, how is it possible to add them to a particular calendar without me using the Calendar app directly? The Applescript library for Calendar doesn't list an import ...
0
votes
1answer
39 views

Applescript Access Variables Through Run Script

Let's say I have a script: set hi to 7 run script "display dialog hi" When I run it, it says that hi is undefined. Is there a way to make hi accessible from the run script command? If not, what ...
0
votes
0answers
124 views

AppleScript & Notes App

Is it possible to use AppleScript to change the font in the Notes App? I am not very familiar with AppleScript, so I may have missed something, but my attempts to change the font have failed. The ...
0
votes
2answers
101 views

Make script run without interrupting GUI experience

I have an AppleScript that automatically opens SelfControl.app to help avoid distractions when I want to be working. The script is very similar to automate an Internet content filter, and it is ...
1
vote
2answers
271 views

Any way to change sound output device via Applescript or shell?

I would like to change sound output device (like option-clicking the speaker icon in the menubar) via script, but NOT through UI scripting, e.g., launching the System Pref panel. UPDATE: Using ...
1
vote
0answers
170 views

SecurityAgent Password not getting filled via AppleScript 10.11 El Capitan

My AppleScript no longer seems to work in 10.11. I put quite a few debug statements in my script and it doesn't seem like the script continues to run after the dialog appears. Does anyone have a ...
0
votes
1answer
46 views

Delete Keystroke from AppleScript

Context In Safari, there is a text field, in which, contains name of an image with extension .png, and I have to remove that extension. Solution Write a script, in which, simulate Delete(⌫) key 4 ...
1
vote
1answer
90 views

Making a command key for an option that already exists

Introduction: Hello, my formatting may look weird but I'm hoping it will be more concise for you and easier to follow, I have ADHD so my writing sometimes goes from one thing to another without any ...
0
votes
0answers
46 views

Finder can't handle objects of this class

I am following the instructions on this website Optimize CS:GO... trying to run this script in AppleScript Editor. set myfilepath to "Users:MYUSERNAME:Desktop:Counter-Strike Global Offensive.app" ...
1
vote
1answer
84 views

Automating Terminal Commands with AppleScript

I have an Arduino-based device (www.picobrew.com) and needs firmware updating. The company wrote a little app to do it for Windows users, but us OS X users are out in the cold. Fortunately, we were ...
0
votes
0answers
27 views

Applescript unable to get the participants for every chat

I'm trying to access the chat participants for every chat in Messages. Currently my script is this: tell application "Messages" to get participants of every chat However, the result is a missing ...
0
votes
1answer
35 views

Mail Script that moves messages with download links to a folder

I am a music supervisor and I receive lots of emails with links to download new music. I'd like to sort these into their own folder automatically. Is there anyway to sort emails that have links to ...
1
vote
1answer
155 views

Automating numbers, Exporting the file as an excel document

I have recently acquired a Macbook Pro (OS X Yosemite 10.10.4). I find the Numbers application satisfactory to work with, but I save the file as an .xlsx file after I am done. I need to make changes ...
2
votes
1answer
77 views

How do I run a binary program without showing the gear icon?

I created a automator workflow, add a Run Shell Script part and put these lines in: /Users/xxx/Library/Android/sdk/tools/android avd I saved it as an app and it works. But I will always see a ...
0
votes
0answers
10 views

Applescript message when Remote Desktop connection established [duplicate]

I am trying to create an applescript that will send a message to me when a computer is being remotely viewed. I have this so far: tell application "Messages" to send "Boo!!" to buddy "Number" of ...
2
votes
1answer
30 views

Copy BPM & Star rating to Comments in itunes using Applescript

I want an applescript to grab the BPM & Star Rating of a selected group of MP3's and paste the info into the comments section. I found this code that will copy the star rating one track at a ...
1
vote
1answer
490 views

How to automatically connect VPN when connecting to a network?

In my university, the only way to access Internet is to connect to a VPN server. I've configured the VPN on my Mac and it's working fine, but I need to manually connect to the VPN every time I connect ...
0
votes
1answer
76 views

Need script to automatically export Skim PDFs with embedded notes

I have a folder with a few thousand PDF files, most of which have Skim annotations (e.g., highlights and notes). If I had fewer files, I'd just go through each one, export the PDF with embedded notes, ...
2
votes
1answer
74 views

Have OS X auto-search for WiFi

My school has installed PowerCloud, which does not officially support OS X. It works sometimes, sometimes it doesn't. I've tried to narrow it down but it's impossible. I was wondering if there is a ...
1
vote
0answers
771 views

AppleScript auto Email attachment save

I am looking for an AppleScript, that simply uses an email defined by the "Mail Rules" and extracts the attachment to a specific folder. I found different codes, but they all didn’t do want I want. I ...
0
votes
1answer
60 views

Applescript: How to move a file after finishing processing it?

I'm very new to writing applescript, but have been painfully working through it. I have successfully written scripts to download specific csv attachments from an email inbox, then create an SQL ...
0
votes
2answers
169 views

Applescript: Automatically check and remount server volume stopped working

Yesterday, I found a script that makes my Mac (MacBook Pro running El Capitan) automatically check for a volume on a server and remount it if the connection drops. I adapted it slightly to this, so my ...
1
vote
2answers
47 views

Copy a file's NSURL to clipboard

I am trying to do a rather simple thing: in the context menu I want to have an action (e.g. with Automator) that gets and copies the file's NSURL to clipboard. The solution seems simple, but it does ...
0
votes
1answer
131 views

Using AppleScript to Send Email from Mail.app to Multiple Addresses

I am able to successfully send out an email with an attachment to a single email address using the code below: on run argv set theSubject to (item 1 of argv) set theAttachmentFile to (item 2 ...
2
votes
1answer
62 views

Remove folder name from file name based on existing Apple Script

so I have this apple script here that I used to insert the folder name into the front of all the files in the folder. The script is able to run through every single folder and target all the files and ...
1
vote
0answers
359 views

Error executing AppleScript through Launchd - “Service could not initialize”

I've written an AppleScript that turns our CenturyLink modem's wireless radio on or off. It works when I run it manually with osascript, but now I'm trying to get it set up on a schedule with Launchd. ...
1
vote
0answers
45 views

How to get text from Facebook webpages using Automator?

I am managing a network on Facebook that has about 3 million subscribers in about 500+ groups... I used to extract text from those Facebook Group pages using Automator, after getting a huge text file ...
1
vote
1answer
56 views

Is it possible to read the accessibilityLabel attribute of an item using AppleScript?

I'm trying to extract the list of cookies according to Safari. I have the following code fragment: tell application "Safari" to activate tell application "System Events" to tell process "Safari" ...
0
votes
0answers
77 views

Only copy files modified after certain date, and maintain file structure

So, I had to do some work on a drive that's used where I work. It's an important drive, and couldn't be down while I did this, so I copied the files to a new drive for use while the other was ...
0
votes
3answers
145 views

Applescript Won't Invoke Shortcut Command

I have a long TextEdit document I frequently open (via a keystroke, thanks to Alfred). It contains many non-standard spellings, so I de-select "Check Spelling While Typing" (though I want spell ...
0
votes
0answers
17 views

Possible to create a hyperlink to a specific contact in Contacts.app or specific event in Calendar.app?

Is there a way to create a link/hyperlink to a specific contact in Contacts.app or a specific event in Calendar.app? I'm thinking of something along the lines of a contact://contact-guid or ...
1
vote
1answer
306 views

Outlook 2016 for Mac won't return “current messages” from main window

In Outlook 2011 for Mac, I was able to use an AppleScript to move currently-selected messages from the main Outlook window. The script started like this: tell application "/Applications/Microsoft ...
1
vote
1answer
26 views

Applescript to check for the existence of a file

I record radio programs during the night and then run an applescript to rename the files. I have the script working unless there is no file named that I am attempting to call and rename. Here is my ...
0
votes
1answer
95 views

How to pause Applescript when another process is not responding to system events?

I would like a Applescript to pause while a specific process/script/app is not responding (temporarily or permanently) to system events, and to start-up again when the other process is back. In ...
0
votes
0answers
46 views

Apple Script to Send Message to Most Recent “Messages” Conversation

Starting with the following line: set _message_ to "Example message" I am looking for a way to send _message_ to my most recent conversation in Messages. This means the conversation I most recently ...
0
votes
1answer
106 views

Applescript to change subject line

I have been looking up for the last two days and found a few applescripts that claimed to change the subject lines. But none of them seem to be able to change/set the subject line. What do you guys ...
0
votes
1answer
106 views

How to get the window id with title of every process?

I'm using the following simple script: tell application "System Events" to get the title of every window of every process Which works by printing titles of every window. tell application "System ...
0
votes
1answer
110 views

Applescript to move focus to active or next window

I am trying to implement a "Command-tab" style setup that works only within a specific space. For most apps, "Ctrl-F4" which is "move focus to active or next window" works correctly, but for ...