1

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"
1

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.

  • You are right -- I can't find any way to set up a keystroke shortcut (with or without using function keys) for the script, which works fine (thanks!). I will explore FastScripts... – Adak47 Aug 8 '18 at 13:53
  • @Adak47, If you want to use a standard style keyboard shortcut, two or more keys with using the standard modifier keys, you can use an Automator service and an AppleScript action. However, this can have its issues and why I switched to using FastScripts. – user3439894 Aug 8 '18 at 14:00
  • I have FastScripts now, and while I can create a two-keystoke shortcut to drop the Script Editor menu, I can't get F15 by itself to work. Using the FastScripts keyboard preferences, typing F15 into the shortcut field doesn't enter it. But using any preface key (control, option, command) in conjunction with F15 does. They may be another way to get a single function key to work as a shortcut, but I haven't been able to find it yet. – Adak47 Aug 8 '18 at 17:58
  • @Adak47, My keyboard only goes up to F12 however, I was able to use F6, which isn't presently set to anything else, by itself to trigger this script with FastScripts. – user3439894 Aug 8 '18 at 19:00
  • I have the extended keyboard with F1-F19. Most of the function keys above F12 have no pre-designated function. All of the lower ones do (adjusting screen brightness, sound volume, etc.) although one can access user- or app-defined functions by pressing fn before the function key. The exception is the F6 key -- I can find no pre-defined system function for it, nor can I find any use of the F6 key by any app when I check Keyboard Shortcuts in the System Preferences. So the F6 should definitely work, but it doesn't. – Adak47 Aug 8 '18 at 19:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .