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

 

Comments

Add Comments

Name:
Comment:

 

About

As someone who has worked on Macs since 1989, I will use my experience to share tips and tricks with you on Fridays. As a Mac user since 1989, I have seen the evolution of Mac software and hardware, and I know how Mac computers work. I also know how to troubleshoot and fix Mac problems that can arise.

Schedule

WednesdaySnagIt for QA
ThursdayPython
FridayMacintosh
SaturdayInternet Tools
SundayOpen Topic
Monday Media Monday
TuesdayQA