How can I set keyboard shortcuts for FastScripts menus?
  • I want to write a script that adds FastScripts shortcuts. I was trying to use Applescript GUI scripting to open the "Script Shortcuts" tab of the "FastScripts Preferences" window, but couldn't get the window to open. What am I missing? Is there another way to do this?

    activate application "FastScripts.app"
    tell application "System Events"
    tell process "FastScripts"
    perform action "AXPress" of menu item "Preferences…" of menu 1 of menu bar item "FastScripts" of menu bar 1
    end tell
    end tell
  • Hi there - you may have noticed the "key combination" attribute of script items in FastScripts's own scripting dictionary. Unfortunately it's read-only. This is an outstanding feature request to make it support writing the keyboard shortcut as well from a script.

    FastScripts may not be very compatible with the type of GUI scripting you're trying to do. I haven't tested this. I don't know if "menu extras" are generally accessible by this means.

    Does anybody else reading know if it's possible to GUI script the status menu items?

    I realize this could be a big pain ... what are you looking to accomplish, maybe I can somehow help facilitate it. Are you migrating keyboard shortcuts from another app? Or you're just trying to set a bunch by name from the script, to avoid the manual labor?

    Or are you trying to write a script that will set up the same keyboard shortcuts on multiple macs?


    Daniel
  • > [snip]
    >
    > if it's possible to GUI script the status menu items

    It seems possible to script menu extras through System Events process "SystemUIServer," but 3rd party apps don't appear. Also, sending applescript directly to the FastScripts process doesn't seem to do anything, although a prerequisite to GUI scripting is to activate the app (I guess to have the key focus) which I can't figure out how to do

    > [snip]
    >
    > what are you looking to accomplish

    My workflow goes like this:
    1. Write a script
    2. Assign a shortcut through Fastscripts

    Currently step 2 is:
    a. save the file
    b. click on the FastScripts menu extra
    c. hover over the FastScripts menu item
    d. click Preferences…
    e. click the "Script Shortcuts" tab
    f. find the script
    g. click in the shortcut field
    h. type the key combo

    Definitely not complaining (because I'm eternally thankful even to have the shortcut capability), but in the spirit of Utopia through applescript, I'd love to have the capability to click, say, ctrl-s and go right to 2.h.

    My first tack was to use GUI scripting to navigate to the key combo field, but only because there seemed to be no way to do it through the dictionary...

    Of course, if there was a way to do it directly through the dictionary, this would be IDEAL!!!
    e.g. key combo field editable, Or a command like make new shortcut "cmd-i"...

    Thanks for getting the conversation going so quickly!
  • I can see how this would be very handy. And I applaud your attitude of trying to script things as much as possible. Of course, that's one of the main reasons I wrote FastScripts for myself ;)

    I'll make a note to myself to look into this more when I get some time to dive in deeper. Maybe there's a way to script it with GUI scripting, or maybe I'll bite the bullet and try to add the most desirable direct scripting support for shortcuts.

    Either way, I hope if somebody has other suggestions, they'll chime in.

    Daniel
  • Hey there! Still loving the program :) I was wondering if you made any progress on this...

    Did you ever implement direct manipulation of keyboard shortcuts through applescript?

    Also, did you figure out of there was a way to use GUI scripting via the menu extra?

    Thanks!

    - Sean
  • Hi Sean - thanks for checking back in. Unfortunately I haven't had the chance to make any more progress on this front, since your last message. I am pretty sure though that the GUI scripting of FastScripts doesn't work. At least in my efforts to try to make it happen, I couldn't get it going.

    Daniel
  • Yep, me neither. I posted a question to apple's applescript list, so if there's a way, I'm sure someone will share it. Obviously, the ultimate dream would be to set shortcuts directly with the dictionary :)
  • Yah- it is still on my TODO list ... unfortunately, some other apps I'm working on right now are taking a lot of my time!
Start a New Discussion

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!