KeyBoard observer?
-
Hi all!
Is it possible to have a KeyBoard observer? We may know all key pressed... That will be useful! I know there is aonKeyDown
inside theclass
tool, but it can't be invisible...
Thank you! -
I don't think it is Matt. But who knows, these folks have lots of work arounds and ruby tricks.
Chris
-
I hope so!
-
Anyone else? So impossible? Fredo I KNOW (I hope) you have a solution
-
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
-
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#p108106Fredo
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.
-
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
-
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! -
OK, so can you explain what you're trying to do? Perhaps there is a better way..
-
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...
-
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
Advertisement