| View previous topic :: View next topic |
| Author |
Message |
Fenchu Guest
|
Posted: Mon Aug 10, 2009 12:51 am Post subject: Help with looping |
|
|
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
|
Posted: Mon Aug 10, 2009 12:57 am Post subject: |
|
|
Honestly, your script raises several red flags . 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 |
_________________
- 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 |
|
 |
Fenchu Guest
|
Posted: Mon Aug 10, 2009 1:13 am Post subject: |
|
|
| 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
|
Posted: Mon Aug 10, 2009 1:16 am Post subject: |
|
|
You want a do-until loop? or perhaps a do-while loop? _________________ Hezzu - excuse the english! |
|
| Back to top |
|
 |
Fenchu Guest
|
Posted: Mon Aug 10, 2009 1:22 am Post subject: |
|
|
| 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
|
Posted: Mon Aug 10, 2009 1:55 am Post subject: |
|
|
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 |
_________________
- in case I forgot to smile
Basic Webpage Controls
COM Object Reference |
|
| Back to top |
|
 |
|