Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trigger if key pressed for time?
#1
Trying to come up with a way to trigger activating a window if key is held down for 5 seconds.
#2
I think I should be more clear and say, I want one thing to happen if the key is held down for 5 seconds, and another to happen if key is just pressed. Thanks
#3
Time a key is pressed
#4
When I try to run it I get this error.


Attached Files Image(s)
   
#5
It must be function "key_pressed_time", not macro "Macro5".
#6
Could you point out the lines that;
1. return the key pressed times
2. end the function/macro so it stops running
I see the 10889 on this key press but can't figure out how to work with it. Also I tried to omit parts of the code but the function just keep running for ever.


Attached Files Image(s)
   
#7
QM keyboard triggers don't tell you how long the key was pressed. Need another keyboard trigger engine. This function is basic code for it. Current version just gives you virtual-key code and key-pressed duration when a key is released. It does not "eat" keys. Need some more programming to make it do what you want.

This function must be running all the time. If you want to end it, run it again. It should not have a keyboard trigger.

To run macros, edit the "out t" part. Add code that launches macros (use mac) depending on values of vk (virtual-key code) and t (duration in milliseconds). The macros will run on key up event. Better place the code in other function, and call it from this function like "MyKeyTriggerFunction vk t".


Forum Jump:


Users browsing this thread: 1 Guest(s)