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 

Help with looping

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





PostPosted: Mon Aug 10, 2009 12:51 am    Post subject: Help with looping Reply with quote

Could someone help me solve this problem? I want use pause key like switch... but i have made some mistake with break command :/

Code:
#IfWinActive
pause::
switch3 := !switch3
if switch3
{
mouseclick, left
mouseclick, left
Loop
{
send, {Enter}
}
return
}
else
{
break
}
return
Back to top
jethrow



Joined: 24 May 2009
Posts: 1907
Location: Iowa, USA

PostPosted: Mon Aug 10, 2009 12:57 am    Post subject: Reply with quote

Honestly, your script raises several red flags Shocked. To answer your question, the Break command must be used inside a Loop. Currently, you Loop keeps sending enter and never ends. Here is a more structured version of your script:
Code:
#IfWinActive ; what does this do?
pause::
   switch3 := !switch3
   if switch3 {
      mouseclick, left
      mouseclick, left
      Loop {
         send, {Enter} ; infinite loop
      }
      return
   }
   else {
      break ; break what?
   }
   return

_________________
Very Happy - in case I forgot to smile
Basic Webpage Controls
COM Object Reference


Last edited by jethrow on Mon Aug 10, 2009 1:14 am; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Fenchu
Guest





PostPosted: Mon Aug 10, 2009 1:13 am    Post subject: Reply with quote

Sorry i just tested this script. It shloud work in game where enter is fire. Break should stop the infinitie loop of releasing enter. I found in documentation that break command must be used inside a loop but what if i want to use it like this way? Thank you a lot for you help...
Back to top
Hezzu



Joined: 08 Aug 2008
Posts: 117
Location: Raahe, Finland

PostPosted: Mon Aug 10, 2009 1:16 am    Post subject: Reply with quote

You want a do-until loop? or perhaps a do-while loop?
_________________
Hezzu - excuse the english!
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Fenchu
Guest





PostPosted: Mon Aug 10, 2009 1:22 am    Post subject: Reply with quote

the goal is press pause to do double click ,start infinite enter loop and press pause again should stop it.. i hope i wrote it clear now.. sorry for my english :/
Back to top
jethrow



Joined: 24 May 2009
Posts: 1907
Location: Iowa, USA

PostPosted: Mon Aug 10, 2009 1:55 am    Post subject: Reply with quote

Requires AutoHotkey_L

Code:
#If (!switch3 && WinActive("Window Title"))
pause::
   switch3 := !switch3
   Click 2
   While switch3 {
      Send, {Enter}
      Sleep, -1
   }
   Return
#If

#If (switch3)
pause:: switch3 := !switch3
#If

_________________
Very Happy - in case I forgot to smile
Basic Webpage Controls
COM Object Reference
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
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