sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Shortcut key(s) for a plugin(s)

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 5 Posters 264 Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Wo3DanW Offline
      Wo3Dan
      last edited by

      (trying ruby again.....)
      At the end of a SU plugin you can specify in which menu a plugin should show up.
      Is this code enough to also let it show up the 'Shortcut' list, ... to then assign a key to it?

      1 Reply Last reply Reply Quote 0
      • renderizaR Offline
        renderiza
        last edited by

        I have never heard this being done before but if it was possible that would be really cool!

        Something tells me is not possible but I hope I am wrong!

        [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

        1 Reply Last reply Reply Quote 0
        • Wo3DanW Offline
          Wo3Dan
          last edited by

          @unknownuser said:

          ....Something tells me is not possible but I hope I am wrong!

          Many (if not all) plugins appear in the shortcut list. So it is possible.
          Select something and then open the list (menu Window > Preferences > Shortcuts > see under 'Plugins'..... (select one and assign))

          I just need to know whether to search for extra code or not.

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            It is possible to force a shortcut... using convoluted coding [PC registry hacking !] BUT you should never force a shortcut-key on a user as it can mess up their own personalized setup.

            IF a tool has a 'menu entry' [either a native-tool OR one made by a 3rd-party plugin] then it will be available for you to add a shortcut key manually - Preferences > Shortcuts > Filter [to find it by name]... assign key-combo...
            The one thing to remember is that if this tool's item only shows if some specific kind of selection preexist [for example the native 'Reverse' only appears in the context-menu if the current selection includes at least one Face]... then you will need to have that kind of selection in effect BEFORE you open Preferences, and then that tool's item will be included in the list of shortcut-able commands...

            Of course once you have a set of shortcuts set as you prefer then, you can export them into a preferences.dat file, and then import that file into another SketchUp version or SketchUp on another computer... That way you can 'take your shortcuts with you'... If you shortcut to a plugin command not available in that Sketchup version it does nothing.

            TIG

            1 Reply Last reply Reply Quote 0
            • renderizaR Offline
              renderiza
              last edited by

              This is great didn't know you could manually assign shortcut keys to plugins!

              Maybe running a web dialog on the background when SketchUp starts so that if user press specific keys it activates the tool that way. Have not tested this but maybe its a solution.

              Again thanks!

              [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

              1 Reply Last reply Reply Quote 0
              • Wo3DanW Offline
                Wo3Dan
                last edited by

                @tig said:

                .....BUT you should never force a shortcut-key on a user as it can mess up their own personalized setup.

                Thank you TIG. By no means I'm not trying to force anything upon anyone. (hell breaks loose if I do)
                But I have seen where some code "directs" the availability of a plugin to one menu or the other. I think I can do so too. (first for myself, and if useful, for others to use).
                But my question is: does that plugin then automatically also appear in the shortcut list, to assign a key to it? (user's choise!) Of course with the appopriate preselection in SU's geometry, if needed. I guess your answer to this was 'Yes', from your quote below. Right?

                @tig said:

                ....IF a tool has a 'menu entry' [either a native-tool OR one made by a 3rd-party plugin] then it will be available for you to add a shortcut key manually - Preferences > Shortcuts > Filter [to find it by name]... assign key-combo...

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  Gerrit, you mean like my Vertex Tools? Where it offers a set of Move, Rotate and Scale tools for vertex editing? If so, I'm currently working on a module where plugins can register commands that duplicate existing SU functions with a validation proc. If the validation proc returns true (for isntance when vertex mode is activated) then the custom tool is activated - if not the native tool is used.

                  Project is on GitHub: https://github.com/thomthom/SketchUpProxyCommands

                  Mind you, it's a WIP! I want it tested more before I say good to go.

                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • A Offline
                    Aerilius
                    last edited by

                    Hi Gerrit,
                    yes, what TIG said is the case, SketchUp takes all menu items from all menus (not only Plugins menu) and allows the user to assign a shortcut for them.

                    If your question was about contextual menu items that are only displayed or activateable under certain conditions (with a validation_proc) then I think the shortcut can only be assigned at the moment when the menu item is enabled (ie. the condition fullfilled, for example selection). All context menu items also appear in Edit → Entity → ….

                    1 Reply Last reply Reply Quote 0
                    • Wo3DanW Offline
                      Wo3Dan
                      last edited by

                      @thomthom said:

                      Gerrit, you mean like my Vertex Tools? Where it offers a set of Move, Rotate and Scale tools for vertex editing? .......

                      Thank you Thomas. No, I meant the most basic thing where, once a plugin is loaded at startup of SketchUp, the plugin is right available in the menu where you let it appear.
                      And at the same time the plugin can (from thereof) also be reached if you assign a shortcut key to it.
                      I wasn't sure whether "placing in the list" was done automaticaly or if you need to have some extra code in the plugin for the list.

                      Example: I place plugin "AAA" in the folder. Looking at the code I see that "AAA" will show up in menu say "Draw". Looking at the shortcut list I can see that I can assign its use to a key.

                      In my case I don't want to use my plugin through any menu but (say lazy as I am) by hitting a key. As it seems SU handles most of that for me. As long as I let it appear in a menu and than find it in the list of shortcuts for assigning it.

                      Thank you Aerilius, for confirming TIG's answer.
                      The idea I have (and have had for a long time) is simple and takes all you writers about two minutes to write. I just want to put this together myself, as simple as the idea is. Otherwise I'll never learn.

                      1 Reply Last reply Reply Quote 0
                      • 1 / 1
                      • First post
                        Last post
                      Buy SketchPlus
                      Buy SUbD
                      Buy WrapR
                      Buy eBook
                      Buy Modelur
                      Buy Vertex Tools
                      Buy SketchCuisine
                      Buy FormFonts

                      Advertisement