AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

breaking a loop

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Looping
Guest





PostPosted: Thu Feb 22, 2007 11:03 am    Post subject: breaking a loop Reply with quote

Hi all,

i'd like this loop to get broken when i press LShift, and then to go on normaly when i release LShift :

Code:
*RButton::   
Loop
{
   Send {RButton}
   GetKeyState, LoopBreakCheck, RButton, P
   if LoopBreakCheck = U
   Break
}
return


i tried to do that but didn't work Laughing thanks for the help
Back to top
Jaytech



Joined: 11 Dec 2006
Posts: 242
Location: Orlando, FL

PostPosted: Thu Feb 22, 2007 5:57 pm    Post subject: Reply with quote

Code:
*RButton::   
Loop
   {
   Send {RButton}
   GetKeyState LoopBreakCheck, LShift, P
   IfEqual  LoopBreakCheck, D
      Loop
         {
         GetKeyState LoopBreakCheck, LShift, P
         IfEqual  LoopBreakCheck, U
            BREAK
         }

   }
return
Back to top
View user's profile Send private message
Looping
Guest





PostPosted: Thu Feb 22, 2007 9:06 pm    Post subject: Reply with quote

thanks but that doesn't work coz now even when i don't push rbutton it gets spammed. rbutton has to be spammed only when i push it, and not to be spammed when i press LShift.
Back to top
NiJo



Joined: 12 Nov 2005
Posts: 73

PostPosted: Thu Feb 22, 2007 9:13 pm    Post subject: Re: breaking a loop Reply with quote

Code:
*RButton::   
Loop
{
   Send {RButton}
   GetKeyState, LoopBreakCheck, RButton, P
   if LoopBreakCheck = U
      Break
   Loop
   {
      GetKeyState LoopPauseCheck, LShift, P
      IfEqual  LoopPauseCheck, U
         break
   }
}
return
Back to top
View user's profile Send private message
jonny



Joined: 13 Nov 2004
Posts: 2951
Location: Minnesota

PostPosted: Thu Feb 22, 2007 10:27 pm    Post subject: Reply with quote

You don't need to check LShift with a GetKeyState:
Code:
*RButton::
Loop
{
   Send {RButton}
   GetKeyState, LoopBreakCheck, RButton, P
   if LoopBreakCheck = U
      break
   KeyWait LShift
}


If you press LShift while the loop is running, it will stop until it's released.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group