Questions tagged [applescript]

AppleScript is the Mac OS scripting language.

127 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
1 answer
1k views

Remove All Illegal Characters from All Filenames in a Given Folder and subfolders

I Know this was was basically answered and the automator with the shell script (Sanitize Filenames) works great, but I need it to also do all subfolders as well. And if possible trim the file name ...
Tim Moseley's user avatar
4 votes
1 answer
2k views

iTerm2: How to get output of a shell command with applescript

I want to get the output of a shell command run through iTerm2's applescript into an applescript variable. I tried the following but it does not work: tell application "iTerm" activate try ...
Lars Bilke's user avatar
3 votes
1 answer
2k views

Creating a cycle between spaces on OS X

On Windows, I constantly used the keyboard shortcut 'alt-escape', which enabled me to move from one window to another without having to press x times 'alt-tab'. I'm new to mac OSX, and it seems that a ...
Amélie's user avatar
  • 31
3 votes
0 answers
252 views

NSUserAppleScriptTask and Script Monitor

I am wondering why some users of our app ghostnoteapp.com see the Script Monitor icon in their menu bar and others, including myself do not. According to the AppleScript release notes " (Script ...
ThomPete's user avatar
  • 143
3 votes
1 answer
2k views

How can I run an AppleScript or shell command on Mac OS X at screen unlock?

Note that this is not the same as startup or login. I never log out of my machine and I want to run the script whenever I unlock the machine to start working.
camdez's user avatar
  • 259
3 votes
1 answer
1k views

Set OS X application preference to stop prompting for admin password

I am trying to write an applescript that sends some actions to an application (specifically waterroof). The problem is, the application periodically asks me for the admin password when I open the ...
Ben Packard's user avatar
3 votes
1 answer
2k views

Save as PDF to Folder Script for Apple Mail

I want to add a script to a rule to auto-print messages as PDF to a specific Folder. What I found was this: http://is.gd/acmsE but it doesn't work for me on OS X 10.6. I already know the Save to PDF ...
patrick's user avatar
  • 1,010
3 votes
1 answer
2k views

Save and reopen Spaces configuration in Mac OS X

Let's say that I am working using several spaces. In one of them I have 20 applications opened with their respective files. My computer crashes and I have to open everything again. Instead I want to ...
asdf's user avatar
  • 221
2 votes
0 answers
76 views

How to quick record system audio in background on macOS?

On macOS Monterey I want to achieve what can be done on Windows with ShareX: record system audio with a global hotkey and have the audio file automatically copied to the clipboard – all in the ...
user0145's user avatar
2 votes
0 answers
51 views

How can I determine what a read-only script does?

I have been given the task of fixing a series of automated tasks on multiple computers. One of the computers in this automated series is an old Mac running OSX 10.4. There are some scripts on this ...
Josh979's user avatar
  • 185
2 votes
1 answer
520 views

How to open iTerm2 version 3 in Forklift

I am looking for a solution which can open iTerm2 version 3 as the default terminal. For iTerm2 version 2 there were multiple AppleScripts on the internet which worked well for opening the current ...
hyperknot's user avatar
  • 892
2 votes
3 answers
2k views

Is it possible to grab and store the returned window id of a terminal opened through applescript or bash?

I have been working on this "dashboard" to help control my localhost server environment. It has been scripted in bin/bash for reference. I recently discovered I can use the bin command "osascript" to ...
Pixxl's user avatar
  • 121
2 votes
0 answers
369 views

Applescript app. won't force OSX to connect with VPN on Mac 10.8.4

I set up an applescript application (saved under the name "BTGuard VPN-OSX) to force OSX to connect with my VPN service (BTGuard). I followed instructions from this link http://lifehacker.com/5932886/...
Abzu's user avatar
  • 21
2 votes
0 answers
133 views

Applescript Adobe Updater

So, I am new to Applescript editor and I am trying to write code to automatically update computers. For some odd reason I can not seem to get Adobe to update successfully. I tried using Accessibility ...
Alex's user avatar
  • 21
2 votes
2 answers
784 views

AppleScript to logoff Mac user after closing an application?

I've configured a local user account on an iMac (Lion) to immediately launch Firefox to a specific page after logging in – the page contains a survey to be completed by the user. This works fine. ...
JDF's user avatar
  • 21
2 votes
0 answers
571 views

Script to join WPA2 Enterprise wifi

When I head to work with my MBP running OSX 10.7, I have to go through this series: Join Other Network Enter SSID select Security = WPA2 Enterprise generate a pw via my RSA soft token Join ...
mbb's user avatar
  • 2,536
2 votes
1 answer
567 views

OS X Lion: AppleScript unbearably slow for moving Mail messages

I've been using for years now the following applescript, triggered via iKey by an F12 keystroke: tell application "Mail" to move (get selection) to mailbox "Archive" I'm using it to move inbox ...
GJ.'s user avatar
  • 9,843
2 votes
1 answer
2k views

How to get QuickTime Player 7 to save its export settings?

I'm trying to get QuickTime Player 7 on Mac OS X 10.6.4 to save its export settings so I can batch convert some MKV movies to M4V (MPEG-4). I've already exported a movie using the settings I want. ...
orj's user avatar
  • 383
2 votes
1 answer
615 views

Different Wallpaper if two monitors are attached

I am working on my MacBook Pro. In the office I have 1 27" Monitor attached to it, at home I tend to work without an second monitor. For that setup I want to change the wallpaper if no 2nd monitor is ...
bitboxer's user avatar
  • 353
2 votes
1 answer
98 views

Are Snow Leopard text substitutions scriptable?

I prefer using typographical quotation marks when possible, so I love the Smart Quotes part of Snow Leopard’s text replacement feature. But there are a few cases in which I need to toggle it, and it’s ...
yonatron's user avatar
  • 116
1 vote
0 answers
25 views

Use Vim to edit Applescript file

Is it possible to use Vim to work on applescript files rather than the default Automator or Script Editor program? I searched the webs and couldn't find the same question or an answer anywhere. I ...
Jimmy Long's user avatar
1 vote
0 answers
73 views

Applescript cannot find file that exists

Big picture, I am trying to create an applescript that allows me to open files in neovim from Finder. Though I have found several resources for doing this, none work exactly as-is, so I have to do ...
Catyre's user avatar
  • 11
1 vote
0 answers
64 views

iTunes Smart Playlist... comparing values across playlists?

I'm not entirely sure this is possible at present, though I am tantalizingly close! Maybe with "nested" criteria for the smart playlist...? I'm a keen editor / remixer of tracks. Every time ...
neff's user avatar
  • 11
1 vote
1 answer
51 views

Add a directory of multiple files to iTunes library with Terminal?

Based on this post How can I add a file to iTunes, from the command line, without playing the file which works I want to add multiple files not one. I tried with adding a loop and a find: for f in ./*....
Watzaum's user avatar
  • 11
1 vote
0 answers
188 views

AppleScript Quick Action Services Shortcut issue - MacOS Catalina

Running on: MacOS Catalina 10.15.5 I made a Quick Action in Automator and it works just fine. In fact, I've been using it for a few years. The code in the action itself is not the problem, nor is it ...
postsoundmixer's user avatar
1 vote
0 answers
787 views

How do I switch spaces without using `keystroke` with Apple Script?

I'd like to run an apple script that follows these steps- Make a web browser full screen Open another application which disables my keyboard Return to the web browser When I make the web browser ...
Cauder's user avatar
  • 775
1 vote
0 answers
190 views

How to run an Applescript at shutdown

I am trying to track the occurrences and duration of power outages. I have my computer(Mac High Sierra) powered by a UPS and set to shutdown when there is an outage. I have an applescript that when ...
David's user avatar
  • 111
1 vote
2 answers
2k views

How to open a random file from a specified folder using AppleScript?

Here's the code I have now: tell application "Finder" get some file of (folder (POSIX file "Desktop/musics")) end tell
Catiger3331's user avatar
1 vote
1 answer
196 views

AppleScript - filtering selection (Yojimbo)

I'm currently trying to filter a selection with Applescript. This works: tell application "Yojimbo" to set theYojimboSelection to selection but this does not:    tell application "Yojimbo" to set ...
David Cullen's user avatar
1 vote
2 answers
633 views

How do I click on "Call Using iPhone" using Accessibility Inspector's Hierarchy?

Here's the AppleScript code: set phone_num to "1111111111"-- (put your own number here) tell me to activate display dialog "" buttons {"FaceTime", "Call", "Cancel"} default button 2 with icon path to ...
Brayden Hermann's user avatar
1 vote
0 answers
73 views

Applescript - Customize text-to-speech pronunciation of Chinese characters

I would like to change the default pronunciation of certain Chinese characters and phrases using Applescript. This would be an improvisation of the suggestion given by @JRobert over here. The basic ...
Sati's user avatar
  • 111
1 vote
0 answers
541 views

Using Launchd for an Applescript Application

I created an Applescript Application (called Print Release) that runs without issue (code below): do shell script "rm -R /Users/<account>/release.zip; rm -R /Users/<account>/release; curl ...
krees's user avatar
  • 33
1 vote
1 answer
830 views

How to empty STUCK Trash with Automator

I want Automator script to remove files from Trash without user input. AppleScript empty the trash only works on unstuck files. Similar commands work in Terminal to remove files. sudo rm -rf ~/....
mark stewart's user avatar
1 vote
1 answer
991 views

Mock Desktop switch/4 finger swipe with a script

I have an older Apple wired mouse It has side buttons, which I'd like to program to use like the four finger swipe on the touch pad (the one that switches between desktops). In mouse settings, ...
Ycon's user avatar
  • 111
1 vote
1 answer
101 views

Applescript VPN + document.readyState problems

I'm trying to create an Applescript App to connect to my University's VPN Network. The process is done usually through connecting to a specific WiFi network then connecting to the VPN itself (via the ...
Mitchell Woods's user avatar
1 vote
0 answers
273 views

How to get input with a custom dictation command

I'm trying to write a few scripts to allow me to write code via voice. However, I need a way to specify a way to capitalize a variable name. For example, I want to be able to say, "stud my super ...
Tyler Crompton's user avatar
1 vote
1 answer
96 views

How to send a signal to a running Applescript

I am running a script that basically has a loop inside a loop. I need some way to signal this script to break out of the inner loop. repeat doxyz repeat doSoreWork if signalPresent ...
Dude named Ben's user avatar
1 vote
1 answer
69 views

writeToFile in a .app

I am currently trying to write content inside an Applescript.app which is a resource file. I can write to the .scpt file if I copy it in a different folder out of the Applescript.app @...
user306147's user avatar
1 vote
0 answers
406 views

Toggling Yosemite's Notification Center between “Today” and “Notifications” views (back and forth)

I want to create a keyboard shortcut/trackpad gesture to: - display Yosemite's Notification Center first - then toggle back and forth "Today" and "Notifications" panes every time the corresponding ...
Serge's user avatar
  • 11
1 vote
1 answer
255 views

How do I close a window from an application but not quit the application

I'm trying to have a shell script run and then close itself but not quit Terminal all together. Here's what I have: #!/bin/sh while [ "$JOB_NUMBER" = '' ]; do echo -n "++++++++++++++++++++Job ...
Chris Robinson's user avatar
1 vote
2 answers
240 views

How do I to modify Automator Service ditto command?

Using and Automator Service and an AppleScript that is redly available and exists on this thread of but a "GUI" around ditto. The solution works well, however, I am not getting the behavior I expected....
Craig Lindsey's user avatar
1 vote
1 answer
889 views

Extract text from HTML using Applescript

I am looking to extract text from an html using Applescript, here is the code: <div class="vk_bk vk_ans">3:27 PM</div> I want to extract "3:27 PM" which is the result google gives you ...
Alec Attie's user avatar
1 vote
0 answers
62 views

Mail.app rules not triggering

I have a mail.app rule set up to run an applescript when incoming emails come in with a certain subject, but it does not trigger. I see the emails in my inbox, and the rule is activated, but it does ...
dividedByZero's user avatar
1 vote
0 answers
1k views

AppleScript shows "Document could not be opened. You don’t have permission." but file can be opened?

I am getting a "The document [filename] could not be opened. You don't have permission" when attempting to access several files in an AppleScript. However, I can open these files manually without ...
Nicholas Pappas's user avatar
1 vote
0 answers
769 views

Applescript + pdfpen for ocr on multiple files: how to move on when pdfpen freezes

I'm using the following AppleScript to batch-process pdfs for ocr: tell application "Finder" set target_folder to target of front Finder window repeat with i from 1 to count (every folder of ...
Patrick Allo's user avatar
1 vote
1 answer
229 views

How to allow an application in Mountain Lion in the "Security and Privacy" settings?

Every time I was trying to use an Alfred workflow written in Applescript, I got the error "No user interaction allowed". In Mavericks there is an "Accessibility" option in the "Security and Privacy" ...
politicus's user avatar
  • 1,007
1 vote
1 answer
51 views

Register a file specified by open

So I have this small bundle with applescript made, and it even seems to work as it should. However, it appearently doesnt open my files when it is asked to via the open utility. It works though when I ...
Ingwie Phoenix's user avatar
1 vote
2 answers
4k views

LaunchAgent plist to keep an app running and hiden

I'm using the following script <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist ...
Baugi's user avatar
  • 11
1 vote
1 answer
533 views

OSX script to Check if ffmpeg process has stopped

I have a Automator Workflow that uses Videobox to convert flash videos for multiple devices but cannot tell when it finish a conversion,I know that it uses ffmpeg for its conversion as I can see it in ...
user2033505's user avatar
1 vote
0 answers
473 views

Trying to re-direct emails as plain text using Applescript. Code (inside) isn't working, any help would be great

I have users sending mail through Outlook which formats the text as Rich text. I'm trying to create script where a "catch-all" email address intercepts the email, converts it to plain text then send ...
user197937's user avatar