Collection of AppleScripts I've developed or acquired over the years. Some are great as standalone scripts while others are great for incorporation with others.
This repo is in continuous development and will be updated as scripts are developed (and as I have time).
This repo was created for two main reasons.
With some exceptions, almost all these scripts are executable by themselves via the Script Menu. However, I generally turn to third party automation apps to execute them, including Keyboard Maestro, Alfred, BetterTouchTool and Hazel.
Notes on formatting
For those who are unaware, the standard file format for AppleScripts is
.scptd, but these file types are not readable on GitHub, so for readability's sake, all these scripts have been exported as a
.applescript file (which is just a text file). So if you were wondering about the file type, this is the reason.
Many of these scripts depend on this script library I developed, so if you see the following line at the top of the script, make sure you get that library and place it into
~/Library/Script Libraries otherwise the script is non-functional.
use kl : script "Kevin's Library"
I've divided the scripts into 3 sections:
Clicking the name of the script will show you the script directly, but make sure to view the README for each section by clicking the title of the section to see instructions/explanations/demos.
|Alfred||Show Recent Files for Front App||🌎 🎦||hyperkeyO|
|Browse Current Workflow in Alfred||⌘R|
|Calendar||WFO to Calendar||🌎|
|Finder||Copy Path as Alias||⌘⌃C|
|Go to Custom Folder||too many to list|
|Open Selection in iTerm||🎦||⌥⇧T|
|iTerm||Copy Text and Send to iTerm||🌎||⌘⌥⌃T|
|Keyboard Maestro||Edit Linked or In-Line AppleScript||🎦||⌥⇧E|
|Add|Remove Status Menu Trigger||⌥S|
|Collapse all Pause/Type/Execute Macro Actions||⌥⌃[|
|Copy Front Macro's AppleScript Trigger||⌘⌃C|
|Edit Last Executed Macro||🌎||⌃⇧E|
|Edit Macro Group of Front App||🌎||⌘⌥K|
|Go To Executed Macro||⌘⌥G|
|Run Current Macro||🌎||⌘⌃R|
|Renumber Macro Prefix Numbers||📷||⌘⌃3|
|Set Color of Text||🎦 📷||⌘⇧(C)olor|
|Make Mail URL||⌃U|
|Mark All Inbox Messages as Read||🌎|
|Show Message||🌎 📷|
|Markdown||Insert Markdown Style Buttons||📷||⌥H|
|OmniFocus||Push Due Date||⌥D|
|Safari||Close Left Tab||⌥[|
|Close Right Tab||⌥]|
|Script Debugger||Duplicate Tab||F7|
|Insert Dynamic Handler Description||🎦|
|Open Used Script Libraries||⌃⌥O|
|Run Front Script||🌎||hyperkeyR|
|Duplicate for GitHub|
|Save As Text Script||⌃S|
|Save a Copy of Front Script as Text||⌃S|
|Toggle Minimal View||⌘⌥⇧M|
|Typinator||Edit Last Expanded Rule||🌎 📷||⌘⌃⌥E|
|New Snippet from Clipboard|Selection||🌎||⌘⌃⌥N|
|Document Closers||Close All Un-Saved Documents||📷||⌘⌥⇧W|
|Close All With Saving||📷||⌘⌥⇧W|
|Close All Without Saving||📷||⌘⌥⇧W|
|Close With Saving||📷||⌥W|
|Close Without Saving||📷||⌃W|
|System Control||Restart AirPort Extreme|
|Toggle Menu Bar Visibility|
|Toggle Screen Resolution||⌘⌥F2|
|Various||Click Script Menu||⌃⇧S|
|Paste Safari URL With Title||hyperkeyU|
|Start|Stop Quicktime Screen Recording||⌃⌥Q|
|Play|Pause Apple TV|
|Text Utilities||Extract Between|
|Search With Regex|
|File Utilities||Get File Metadata|
|Various||Click at Mouse Location|
|🎦||script has a gif demo in its section's README|
|📷||script has a screenshot in its section's README|
|📺||video to watch|
|🌎||script is executed globally for a specific app|
Shortcut key symbols
|hyperkey||command option control shift|
Downloadsand install the AppleScript docset to have blazing fast access to AppleScript documentation, plus its free!
kc [<key name>].
In order for scripts to be accessible via the Script Menu, scripts must be stored in
~/Library/Scripts, but if you like to keep your scripts synced between devices, this location is a pain. I used to have a Hazel rule set up to sync
~/Library/Scripts to Dropbox that worked fine for years, but I didn't like all the extra processing needed to sync and worse yet I had 2 copies of every script which was messy and got confusing.
I realized later that moving all my scripts to
~/Dropbox/Library/Scripts then creating an alias to that location and moving it
~/Library allows for my scripts to be stored in Dropbox, and still be accessible in the Script Menu!
This method works exactly as well with the
Here's a screenshot of what it looks like in Finder.
How to do it:
~/Library/Script Libraries/) and paste into the
~/Dropbox/Library/folder you made.
~/Library/. The result will be like
~/Library/Scripts aliasso rename the alias by removing the " alias" part so it looks like
~/Library/Scriptsand you're good to go!
NOTE: Symlinks don't work for this method, I originally tried the following command which did make an alias, but then the scripts weren't accessible via the Script Menu.
ln -s ~/Library/Scripts ~/Dropbox/Library/Scripts/
The caps lock key is a borderline useless key for a decent typist, but what's great about Macs is that we can change that. By a few adjustments in
System Preferences and installing the free software Karabiner, we can turn that useless key into a extremely useful hyperkey.
Hyperkey just means that the caps lock key will emulate holding down ⌘⌃⌥⇧ at the same time, and since no application would use such a combination of keys to execute a command, this makes a whole new modifier key for us to implement.
How to do it:
Keyboardand click on
Modifier Keys...and make it look like this
Complex Modificationsbutton and click the
Add Rulebutton to install the hyperkey mod. You can see the mods I use below.
And that's it! Now you have the super useful hyperkey!
Note that one of the mods I use to toggle caps lock is to click both shift keys at the same time for those rare cases when I need it.
Tutorials I've bookmarked over the years that I've found particularly helpful or educational.
|Safari Stuff||How to Fill Out Forms on Websites with AppleScript|
|How to click a button on a Web Page with AppleScript|
|How to Extract Information From a Website Using AppleScript|
|How to Select a Drop Down Menu With Applescript|
|AppleScript Screen Scraping to Excel Example|
|Keyboard Maestro Stuff||Using AppleScript to Get and Set Keyboard Maestro Variables|
|Scripting the Keyboard Maestro editor|
|Script Debugger stuff||Tutorials | Late Night Software||📺|
|iWork||iWork and Automation|
|Various||Date/Time Calculations using AppleScript|
|Storing and Accessing Data with AppleScript|
|AppleScript Power Handlers|
|Giving your AppleScripts a Face Lift with AppleScriptObjC||📺|
|Starting Out||AppleScript - The Language of Autoamtion||📺|
These scripts are released under the MIT License.