QA Graphic

AppleScript Script Menu

Make AppleScript Accessible in Any app

Adding a script menu to the menu bar is an incredibly useful feature that I recently discovered. This allows you to easily run AppleScript whenever you would like, without having to search for it in your Applications folder. This can be really helpful if you need to run a script regularly, or if you just want easy access to your scripts.

Apple Script Menu

Five Things I Learned

Each application can have a specific set of AppleScript files. This helps declutter the menu and have only the essential scripts shown. Every application can have its own script folder - even if the Applicationdoesn't have built-in support for AppleScript.

In the example above, I have two AppleScripts where I generate an anchor tag for HTML or Markdown. The script output is saved to the clipboard - ready to be pasted in any application.

Do you code in PHP, Python, or BASH? No problem, you can always have AppleScript run your code! Here's a sample line:

do shell script "Python3 ~/scripts/something.py"

That one line of code will execute a Python Script. It can be modified to run any Shell command. Now you can run your code anyplace.

There isn't a way to assign shortcut keys to any AppleScript command.

This is the AppleScript that I wrote to generate the HTML tag of the active Chrome Browser:

tell application "Google Chrome"
	set broswerurl to get URL of active tab of first window
	set browsertitle to get title of active tab of first window
	set the clipboard to "<a href="" & broswerurl & "" >" & browsertitle & "</a >"
end tell

 

About

A Mac veteran since 1989, I'm here to share my experience with tips and tricks every Friday. Witnessing the evolution of Mac software and hardware firsthand, I've gained a deep understanding of how these machines work and can help you troubleshoot any issues that may come up.

Schedule

WednesdayAffinity
ThursdayBBEdit
FridayMacintosh
SaturdayInternet Tools
SundayOpen Topic
MondayMedia Monday
TuesdayQA