4 Replies Latest reply on Jul 9, 2008 12:31 AM by [Jongware]

    Add Shortcut to a Window

      I have a small problem, i hope someone can help me.
      I have a Window, for that window i would like to add a ShortcutKey
      (I create that with ScriptUI)

      window.shortcutKey = "Ctrl + Alt + Q" for example, the problem is, every time i try to add a shortcut to window.shortcutKey i get a message "Bad Argument".
      I looked in the Javascript Tool Guide but there is no example how the Argument, for example, (Ctrl+Alt+Q) should look like.

      All i know is that the argument type is a String.

      Thanks everyone
        • 1. Re: Add Shortcut to a Window
          Loic.Aigon Adobe Community Professional
          You may as well assign the shortcut through the shortcut manager of Indesign. In this particular window, ask for your script in the script section to be launched with Ctrl Alt Q. OF course, I guess it's not convenient fo you because you will certainly desire the shortcut is available for any users without having to set it by hand one by one.
          • 2. Re: Add Shortcut to a Window
            [Jongware] Most Valuable Participant
            Where did you find "shortcutKey"?
            According to my JS help, it's not an Indesign property for windows -- or for any object, really.
            • 3. Re: Add Shortcut to a Window
              Level 1
              thats what i did, thank you. I prefer the other way (the customer too)but first, it fixes the problem.
              I am beta tester for Adobe Indesign CS4 according to my extend Script Toolkit (Documentation) there is a property (shortcutKey) for the window, for Cs3 too.
              I create the Gui with the ScripUI Objects.
              (Window.shorcutKey = "").

              Perhaps it is a new property ?

              Have a nice Day.
              • 4. Re: Add Shortcut to a Window
                [Jongware] Most Valuable Participant
                >for Cs3 too.

                It's not in my own InDesign JS guide, and thus (probably) not in the original ESTK2 help.
                I also can't find it in the Javascript Tool Guide.

                It might be a new property with CS4, or just an omission from the current (CS3) help (unlikely, the way I understand that help is built).

                A bit of reverse engineering might help you out, though. Assign a shortcut to your window the usual way -- through the Keyboard Shortcut editor. Then do an "alert ("The shortcut string looks like "+yourWindow.shortcutKey)".