AutoHotkey Community

It is currently May 27th, 2012, 11:15 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: February 11th, 2012, 2:37 am 
Offline

Joined: February 6th, 2012, 1:40 am
Posts: 2
Hello,

Was here earlier with a problem i had with the send command and this script was suggested to solve my problem:

SetKeyDelay , 30, 30 ; first is delay between keypresses, and second is press duration

; we are using ControlSend here because Send and SendInput is not affected by SetKeyDelay.
$1::
ControlSend, , 8, A
ControlSend, , -, A
ControlSend, , 0, A
ControlSend, , 5, A
ControlSend, , z, A
ControlSend, , 1, A

Return

Works like a charm. Basically what this script does is when i press 1 it also sends these other keys with a 30ms delay between them. I use this script in a game and when i hit 1 many times after eachother it qeues up the ControlSend command.

What i would like is for the script to cancel the previous send command and start the script anew when i press 1 again so it doesnt go through the qeue of keypresses. Is there any way to do this?

Any help would be most appreciated. I've tried to solve this issue myself, but i cant seem to find anything useful (and i'm very new to scripting).

Thanks :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2012, 4:31 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
:?:
Code:
send:="8-05z1"
$1::
KeyWait,1
Loop,Parse,send
{
   ControlSend, , %A_LoopField%, A
   KeyWait,1,DT0.05
   If !ErrorLevel
      goto $1
}
Return

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 12th, 2012, 12:06 am 
Offline

Joined: February 6th, 2012, 1:40 am
Posts: 2
Thanks a lot, i will give this a try :D


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, Yahoo [Bot] and 12 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group