Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
need some help with a function
#1
First off, great program!
I am new to programming and i learn by examples but i could find none that address what i am trying to do.
Can i use a timed input to stop a function? Say i want to stop a function by pressing and holding the A key for 2 seconds. How would i code that?

Also is it possible to:
1. stop a function immediately, reguardless of where it is at in the code(like during a delay)
2. block and unblock keyboard input of only select keys and not all of them

Thank you for any assistance.
#2
to stop a macro running at any point hit Pause/Break. to stop a function thats running use

shutdown -6 "the name of the function here"

to have a macro/function pause in the middle you can just enter the number of seconds to wait.

do stuff
10
do more stuff


it now waits 10 seconds in the middle
An old blog on QM coding and automation.

The Macro Hook
#3
Create new function (any name), assign key trigger, eg A, and paste this code:

wait 0 K a
shutdown -6 0 "function name"

It waits until A is released and then kills the specified function or macro, which can be in any command, including waiting.

Quote:block and unblock keyboard input of only select keys and not all of them

It is possible using modified BlockInput2. BlockInput2 is available somewhere in the forum. It uses low level keyboard hook, and you can modify its hook procedure to filter some keys.

Or try to use keyboard trigger(s). To enable/disable them from code, use function dis.
#4
thanks for shutdown -6 0 "function"

---
Gintaras- wait 0 K a
shutdown -6 0 "function name"
It waits until A is released and then kills the specified function

Not really what i was looking for "on release" but i came up with this that works pretty good

g1
rep
0.1
ifk(F2)
goto g2
goto g1
g2
1.9
ifk(F2)
shutdown -6 0 function ;; function shutdown after 2 seconds of holding key F2
goto g1

---
I get what your saying about enable/disable macros using keyboard triggers, thanks alot.
I looked at Blockinput2 and it is a little beyond me, im not even sure where to place the downloaded file to be able to use the function in quick macros. ie; blockinput2 is not dark red.
*** sorry my code didnt format correctly, figure that out another time[/code]


Forum Jump:


Users browsing this thread: 1 Guest(s)