| View previous topic :: View next topic |
| Author |
Message |
Hester
Joined: 07 Mar 2005 Posts: 27
|
Posted: Sun Mar 13, 2005 9:00 pm Post subject: Loop not breaking all of the time |
|
|
;The script below will not always break.
;When it doesnt break the z key will show up within the Looping text.
;Any ideas how to fix this
| Code: | #MaxThreadsPerHotkey 3
z::
if looping = 1
{
looping = 0
return
}
looping = 1
Loop,
{
if looping = 0
break
Send, Looping {enter}
}
looping = 0
return |
|
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Mon Mar 14, 2005 12:10 am Post subject: |
|
|
What do you want to do with this script. It doesn't make any sense to me. And until then I do not understand your problem.
Do you want to stop a loop started from a first instance of the hotkey with a second instance of the same hotkey? _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Hester
Joined: 07 Mar 2005 Posts: 27
|
Posted: Mon Mar 14, 2005 12:19 am Post subject: |
|
|
I want to press one key and have it repeat until the key is pressed again.
In this script when the z key is hit and displays Looping repeally in notepad until I press z again, but sometimes it does not break. |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Mon Mar 14, 2005 12:33 am Post subject: |
|
|
Have you ever tried this?
| Code: | z::
if looping
Gosub, SubLooping
else
looping := not looping
return
SubLooping:
Loop,
{
if not looping
break
Send, Looping {enter}
}
return |
*not tested**braindump* _________________ Ciao
toralf  |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Mon Mar 14, 2005 12:43 am Post subject: |
|
|
I just tested it myself, and It didn't do any good. sorry _________________ Ciao
toralf  |
|
| Back to top |
|
 |
corrupt
Joined: 29 Dec 2004 Posts: 2402
|
Posted: Mon Mar 14, 2005 12:58 am Post subject: |
|
|
| Code: | #Persistent
x := 0
doloop =
SetTimer, doit, off
Return
z::
if doloop =
{
SetTimer, doit, 250
doloop = stop
}
else
{
SetTimer, doit, off
doloop =
}
return
doit:
x ++
Send, Looping %x% {enter}
Return |
|
|
| Back to top |
|
 |
Hester
Joined: 07 Mar 2005 Posts: 27
|
Posted: Mon Mar 14, 2005 1:24 am Post subject: |
|
|
Thanks this code works. It added $*z:: to make it run better.
before
z:: ; z in text
Looping 1
Lzooping 2 <-- z here
Looping 3
Looping 4
Looping 5
Looping 6
Lzooping 7 <-- z here
added
$*z:: ; no z in text
Looping 1
Looping 2
Looping 3
Looping 4
Looping 5
Looping 6
Looping 7 |
|
| Back to top |
|
 |
|