sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    KeyBoard observer?

    Scheduled Pinned Locked Moved Developers' Forum
    11 Posts 4 Posters 384 Views 4 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.
    • M Offline
      Matt666
      last edited by

      Hi all!
      Is it possible to have a KeyBoard observer? We may know all key pressed... That will be useful! I know there is a onKeyDown inside the class tool, but it can't be invisible...
      Thank you!

      Frenglish at its best !
      My scripts

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        I don't think it is Matt. But who knows, these folks have lots of work arounds and ruby tricks.

        Chris

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • M Offline
          Matt666
          last edited by

          I hope so! 😞

          Frenglish at its best !
          My scripts

          1 Reply Last reply Reply Quote 0
          • M Offline
            Matt666
            last edited by

            Anyone else? So impossible? Fredo I KNOW (I hope) you have a solution πŸ˜„ πŸ˜†

            Frenglish at its best !
            My scripts

            1 Reply Last reply Reply Quote 0
            • Chris FullmerC Offline
              Chris Fullmer
              last edited by

              I'm guessing that the only possible answer will be something like using win32 for windows and then try to find something like that for a Mac - How fun!

              Chris

              Lately you've been tan, suspicious for the winter.
              All my Plugins I've written

              1 Reply Last reply Reply Quote 0
              • fredo6F Offline
                fredo6
                last edited by

                There is a plugin by Pecan doing keyboard spying.
                It just works on Windows.
                see http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=14280&hilit=plugin#p108106

                Fredo

                PS: I did not try it yet. Actually, it would be good if someone could find an equivalent solution on Mac, so that the two platforms remain on par.

                1 Reply Last reply Reply Quote 0
                • AdamBA Offline
                  AdamB
                  last edited by

                  My 2 cents worth.

                  I think when you find yourself jumping through hoops to do stuff like this, you really need to question whether its a good idea.

                  Sketchup has a model of Choose a Tool, Do stuff with that tool, choose another tool... And I just feel you're asking for a world of pain if you start trying to break that design by reaching outside your scope and pinching key strokes from somebody else.

                  I know you can do it.. I just don't think its a good idea to do so. πŸ˜„

                  I'll get my coat..

                  Adam

                  Developer of LightUp Click for website

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    Matt666
                    last edited by

                    hi all!

                    @unknownuser said:

                    I just don't think its a good idea to do so.
                    In fact, I don't know the best solution for my need... That's just the first idea that comes! 😳 Thank you for giving your opinion, Adam, and you give another idea!

                    @unknownuser said:

                    Actually, it would be good if someone could find an equivalent solution on Mac, so that the two platforms remain on par.
                    I agree, Fredo. A solution that do things by halves is not a good solution...

                    @unknownuser said:

                    I'm guessing that the only possible answer will be something like using win32 for windows and then try to find something like that for a Mac - How fun!
                    😲 Just a little bit too difficult for me! πŸ˜†

                    Frenglish at its best !
                    My scripts

                    1 Reply Last reply Reply Quote 0
                    • AdamBA Offline
                      AdamB
                      last edited by

                      OK, so can you explain what you're trying to do? Perhaps there is a better way..

                      Developer of LightUp Click for website

                      1 Reply Last reply Reply Quote 0
                      • M Offline
                        Matt666
                        last edited by

                        I'm trying to do smt with my plugin Recall last tool...
                        plot-paris had an interesting idea:

                        @plot-paris said:

                        Just a thought: does it make sense to have a similar tool go through several previously used tools when pressing the shortcut key repeatedly?

                        My first thought was to add an observer on keyboard, that's why I create this topic... But now I think I should add a tools observer that control if tool has been activated twice in a row...

                        Frenglish at its best !
                        My scripts

                        1 Reply Last reply Reply Quote 0
                        • Chris FullmerC Offline
                          Chris Fullmer
                          last edited by

                          I'm guessing you already have a tool observer set up or something? You've already figured out how to keep track of the previously used tools, right? If so,

                          Lets say you have a global variable that holds an array of all the last used tools - $previous_tools

                          Also, maybe you need a menu item for "Set Shortcut Key". This is for the user to tell your script what key they have assigned your script to (it might save the value to an external text file or a registry entry would be better). So perhaps they assign it to "t", your inputbox could create a global variable $previous_tools_shortcut = "t"

                          Now make a tool with the onKeyUp method in it. It compares the onkey up to $previous_tools_shortcut. And it also implements its own timer feature. So you can watch the time between keystrokes. So if they press the dhortcut key 1 time, it just selects $previous_tools.last. If they press it twice within a specified time limit (.5 seonds or less) then it will select $previous_tools[length-1], press it three times within 1 second, it selects the $previous_tools[length-2] tool.

                          That is how I think I would go about it. But that assumes you have an array of the previously used tools, and it also requires the user to input the shortcut key that they assigned to your tool.

                          Chris

                          Lately you've been tan, suspicious for the winter.
                          All my Plugins I've written

                          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