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

learn more… | top users | synonyms (3)

1
vote
1answer
51 views

Why is my AppleScript not working?

Making an AppleScript but for some reason it isn't working. Any ideas why not? delay 1 set volume 1 say "Hello " & (do shell script "whoami") using "Whisper" say "Do you want to play a game?" ...
0
votes
2answers
45 views

Gaining access to data acquired by AppleScript outside of the script

I'd be interested in using the data that I acquire with an AppleScript in another Framework, or even to write it to disk (the former is preferable). For example, I have an AppleScript where I ask ...
0
votes
1answer
227 views

Send Command to Add remote users through ARD

so I'm trying to create an extra admin account on all Macs on the network. There are quite a few so I'm trying to do it through Apple Remote Desktop. Do you guys know how to do this? This is all I ...
8
votes
5answers
1k views

How to create an OSX Application to wrap a call to a shell script?

My goal is to include in a zip file what amounts to a shortcut, instead of telling my customer(s) to open up Terminal and run a shell script. My deployable essentially looks like this: $ unzip ...
2
votes
2answers
182 views

AppleScript to create spacing format like “S P A C I N G”?

In order to format text documents in a more readable way it would be nice to format selected texts by an apple script executed via the context menu services in the following way: select "text" with ...
0
votes
0answers
75 views

Automator shell script - change file extension

I currently have a task that is working. It takes whatever files are added to particular folder and compresses them via Handbrake to another folder: for f in "$@" do HandBrakeCLI --preset="iPhone ...
2
votes
1answer
93 views

Applescript exits with error when run via launchd

I have an applescript running beautifully in Script Editor as well as from an osascript command at the Terminal. The script talks to the Reminders.app in order to pass iCloud reminder entries to a few ...
1
vote
0answers
34 views

How to create an app with the ability to open files in finder with right click

I want to create a very simple app like this: #!/bin/sh /opt/local/bin/evince $1 evince is a pdf viewer I compiled in OS X. I want to navigate to a pdf document in finder and then right click and ...
0
votes
2answers
169 views

Use Applescript/Automator to select a window highlighted in the Finder

I have an applescript which extracts the name, associated process and and other information about a target window. As of now, the script selects the target window via a "choose from list" dialog that ...
1
vote
1answer
304 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
485 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
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 ...
2
votes
1answer
69 views

Launching apps behind the lock screen?

I need to run an application behind the lock screen, e.g., just as Time Machine or Sophos antivirus (and others) can run when the screen is locked. Specifically, I would like to schedule an ...
1
vote
1answer
96 views

AppleScript: move a folder to library (to root) in iTunes

Does anybody know how to move some folder to library playlist in iTunes? I can move some folder to another folder using the following script: tell application "iTunes" move folder playlist "3" ...
1
vote
0answers
42 views

Email message duplicated from AppleScript

I'm using the following AppleScript within a rule to auto forward emails to Evernote. The issue I'm seeing is the email is duplicated in Evernote. Within Evernote the note contains the email twice. ...
0
votes
2answers
244 views

What is the default function for a play/pause media key?

I have a Microsoft Natural Ergonomic Keyboard 4000. It has a button labelled play/pause. When I have no keyboard drivers installed, the way the button behaves is by toggling playing and pausing in ...
0
votes
0answers
18 views

AppleScript application works not as UIElement

my AppleScript that contains on quit-Handler works if it is visible. If I add to the Info.plist-file of the application the Application is agent (UIElement) with YES. Then the application doesn't ...
0
votes
1answer
70 views

Applescript or Shell rename a file?

The following is the code I have, however, it doesn't let me choose the extension I want to save it as. How can I save the file as a ".plist" ? do shell script "echo '{ Filter = { Bundles = ( \"'" ...
1
vote
1answer
83 views

AppleScript - Add userinput to text file?

How can I add a user input variable to a text file? This is what I have right now: -- ask user display dialog "Enter Cheat" default answer "99 Gold, super health, unlimited Grenades.." set cheat1 ...
1
vote
1answer
93 views

Set Brightness to Full on Boot (MacBook Pro)

I frequently have the problem where my laptop's screen is too dim prior to login and I can barely tell where my account or the mouse is. Is there a way to set the brightness to maximum on boot before ...
0
votes
1answer
62 views

AppleScript: Get list of 15 most recent files in directory

I need to build a string containing the filenames of the 15 most recent files (by modification date) within a directory. Delimited only by a space: file1.jpg file2.jpg file3.jpg I'm using ...
0
votes
1answer
19 views

Applescript causes long error messages to be logged in system.log

I have this very simple script... tell application "System Events" set activeApp to short name of first process whose frontmost is true end tell tell application activeApp repeat 5 times ...
1
vote
0answers
93 views

How do I use Applescript to reply to an email?

Specifically I'm looking for a simple tweak in the Mail app. I have a rule set up to "Reply with text" to certain emails that come in, but one source in particular (Trulia) emails me messages from ...
0
votes
1answer
212 views

Applescript to Heart or Love or Favorite song

Anyone know if there's away to heart/love/favorite a song in the new iTunes via applescript? Basically I want the ability to heart a song from Apple Music without switching back to iTunes.
2
votes
1answer
169 views

Shell Script Commands Work Fine in Terminal But Not Via AppleScript

I have two commands that I need to run through the Terminal. They are cd /Users/[my name]/Desktop and curl 'www.google.com'>google.txt. When running these directly in Terminal they work just fine. ...
0
votes
0answers
65 views

Count of windows with AppleScript on every desktop

I would like to get the count of the windows on every desktop. With the following code I get only the count on the current desktop. tell application "System Events" set allApplications to (name of ...
0
votes
2answers
322 views

Applescript “expected then but found identifier”

At present, I have a very simple bash script which calls osascript -e a bunch of times; it looks like this (newlines added for readability): #!/bin/sh osascript \ -e 'tell application "Terminal" to ...
0
votes
1answer
68 views

List all programs without any window and kill them

has anyone an idea for an AppleScript that checks the number of windows of all applications and kills programs with window count 0? Thanks a lot!
0
votes
0answers
98 views

Run Applescript when Finder's 'Open new tab' or 'Open new window' is executed

I would like to run an Applescript when I either open a new or additional Finder window or when I open a new tab. Perhaps with Automator? How would I achieve this? FYI, El Capitan has a Finder ...
1
vote
0answers
85 views

Set environment variable for iCloud Drive path

Foreword Setting env vars on Yosemite seems to be really a pain, but I've managed doing it thanks to this clever way: ...
1
vote
1answer
86 views

Applescript Calculate Run Time of a Command

How would you calculate the time it took to run a command? Specifically, I want to know the time it takes to return a value in a Shell command. I wrote this up, would it work? (Psuedocode) ...
0
votes
0answers
44 views

Applescript to read unread notifications from Notification Centre on an arduino input

I am using applescript on Yosemite to read out (say) unread notifications from the notification centre. The action is triggered on an arduino input. While I can trigger the notification centre I am ...
3
votes
1answer
218 views

How to capture mail.app message url that will remain persistent when message is moved?

So mail.app has this wonderful message:// URL scheme, which works great—until the message is moved. Then links created sometimes work—and sometimes don't. I can't figure out the difference. So my ...
0
votes
1answer
16 views

Re-numerate selected tracks in iTunes

I often do the same job: select each track in selected set of tracks, open Properties of track and set the number of the track. I am just wondring may be there is a script or plugin for iTunes to ...
1
vote
1answer
61 views

Need help with small AppleScript

I'm on Yosemite 10.10.4, Mac Mini. I have a small Bash shell script to start Quake3 Arena in Wine. It works fine. #¡/bin/bash cd Desktop/Quake3ISO hdiutil mount "Quake 3 Arena.iso" cd Quake3 wine ...
0
votes
0answers
72 views

Open Word Doc with Pages using Applescript

How can I get the following to work in Pages? I get an error message saying the file can't be opened but if I change the path to a .pages file it works fine. tell application "Pages" activate ...
0
votes
0answers
113 views

Automator/AppleScript: Sync 3 folders when an item is added to one

Background I'm fairly new to the Automator/AppleScript tools. There are 3 folders on the Mac and external hard drives that should sync when a file is added to one. So, for example, when I add a ...
1
vote
1answer
71 views

Launching Character Viewer (aka CharacterPalette) from command line

So, recently I have being using the Character and Keyboard Viewer a fair bit and set up simple Alfred keywords that toggle the launch/quitting of these apps so as not to have to leave the keyboard. ...
0
votes
0answers
463 views

AppleScript choose file dialog box with default location not working

So there goes four hours of my life that I will never get back. I'm trying to do something seemingly simple... I want to open a file select dialog box and specify the default location. I actually ...
0
votes
1answer
80 views

Applescript to read facebook notifications

I am very new to applescript as well as programming. I am trying to find a way for applescript to access my facebook unread notifications and whatsapp web unread chats and read it out to me. I can ...
0
votes
2answers
97 views

Dock shortcut for an interactive bash script

I'm new to OSX and all I want it an application shortcut in Dock that opens the terminal and types the first command and waits for me to provide the password. Here is the script I want to run: ...
0
votes
1answer
198 views

osascript Expected end of line but found class name?

Not really sure what its expecting here, I assume its around click button though. This used to work on 10.10.3, but seems to have stopped on 10.10.4? Script function AcceptSecurity () { osascript ...
0
votes
0answers
70 views

Automator action to Search with YouTube (Safari)

There is a contextual menu that allows user to search highlighted items with Google. I'd like to create a process that searches with YouTube with applesccript(automator). I tried doing something on ...
0
votes
1answer
57 views

Applescript: Duplicate selection (folder) to desktop and moving the folder to a different location

First of, i'm an applescript noob;-) What I'm asking for is simple but nearly impossible for me to execute. See the script below. tell application "Finder" set selected_items to selection ...
1
vote
1answer
51 views

Toggle Show Date and Time via AppleScript

How can I toggle the "Show date and time in menu bar" option via AppleScript. I'm using OSX 10.10.4. I am looking for a working example in AppleScript.
2
votes
1answer
76 views

Adding content from mail to Excel using Applescript

I have gone through and used some great code form the these forms for Adding content from mail to Excel using Applescript. I am nearly there but have one more question. I have the following layout of ...
0
votes
0answers
16 views

Create directory inventory when ejecting

I use UnDock Now! to eject external hard drives, which allows running AppleScripts before ejecting. I would like to have a running inventory in a text file of all of the folders and filenames that ...
0
votes
1answer
92 views

Applescript - Get information from terminal command

I'm creating a little script to allow quick changes to the network settings of my Mac. I have got it all working, but I wanted to be able to see what the settings are before I change them in the first ...
0
votes
0answers
113 views

Replace iTunes playcount with previous library using Applescript loop

After updating my iTunes library to iCloud, the play count of some has been messed up. I was thinking of fixing the missing data by using an Apple Script loop. The loop should scan the playcount of ...
1
vote
1answer
143 views

Applescript - AppleEvent handler failed on set properties {visible messages: }

I have the following applescript working under Lion, but it returns this Error: -10000. Mail got an error: AppleEvent handler failed. error under Yosemite. try tell application "Mail" set ...