Posts: 2
Threads: 1
Joined: Mar 2011
Hello, i was wondering if it was possible to make a macro hold multiple buttons down at one time rather than doing them in quick sequence. So say i wanted to hold "abc" down all at the same time, is there any way to press them all down at the same time, or do they always have to go in sequence?
Posts: 12,095
Threads: 142
Joined: Dec 2002
Macro
Macro1553
To press repeatedly, use this function:
Function
KeyRepeat
;/
function vk ^duration [speed]
;Repeatedly presses a key.
;vk - virtual-key code. See QM Help, "virtual-key codes" topic.
;duration - number seconds to hold key down.
;speed - number of milliseconds between repeated keypresses. Default 50.
;EXAMPLES
;KeyRepeat VK_SPACE 5 ;;spacebar, 5 seconds
;mac "KeyRepeat" "" VK_SPACE 5 ;;the same, but continue macro immediately
;KeyRepeat 'A' 0.5 1 ;;key A, 0.5 seconds, fastest
duration*1000
if(speed<1) speed=50
spe speed
int t1(GetTickCount) t2
rep
,key+ (vk)
,if(duration<0) continue
,t2=GetTickCount
,if(t2>t1+duration or t2<t1) break
spe -1
key- (vk)
Posts: 2
Threads: 1
Joined: Mar 2011
Thank you, I'll test this to see if it works for me.
[edit]Thank you very much, i tweaked the code a little bit but i got what i wanted my macro to do, your help is greatly appreciated.