Applescript to drop down Script Editor in Menu Bar

applescriptscript

I want to write a script that will drop down the menu of the script editor from the menu bar, but without selecting a menu item from it. The idea is to give the script a keystroke shortcut (like F15) that will run the script, drop down the menu choices, and then I will select the script from the list to execute. This saves me having to navigate the cursor over the script icon in the menu bar and then click on it to drop the menu down. Instead, I just press F15 and voila! It appears.

Any suggestions will be appreciated. I made some attempts adapting other examples, but could not make any of them work. I was hoping for something as simple as:

tell application "System Events" to click process "Script Editor"

or

tell application "Finder" to click process "Script Editor"

Best Answer

The AppleScript code you're looking for is:

tell application "System Events" to ¬
    click (every menu bar item of menu bar 1 ¬
        of application process "SystemUIServer" whose description is "AppleScript")

As to assigning F15 to that, well you'll probably need a third-party utility to do that, as I do not believe an Automator service supports using just a single function key, (or any function key), as its keyboard shortcut.

I use a utility called FastScripts for many of my scripts and it will support a single function key.


Note: I am not affiliated with Red Sweater Software, the developer of FastScripts, just a satisfied user.