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 

Loop not breaking all of the time

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Hester



Joined: 07 Mar 2005
Posts: 27

PostPosted: Sun Mar 13, 2005 9:00 pm    Post subject: Loop not breaking all of the time Reply with quote

;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
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Mon Mar 14, 2005 12:10 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Hester



Joined: 07 Mar 2005
Posts: 27

PostPosted: Mon Mar 14, 2005 12:19 am    Post subject: Reply with quote

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
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Mon Mar 14, 2005 12:33 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Mon Mar 14, 2005 12:43 am    Post subject: Reply with quote

I just tested it myself, and It didn't do any good. sorry
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
corrupt



Joined: 29 Dec 2004
Posts: 2402

PostPosted: Mon Mar 14, 2005 12:58 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Hester



Joined: 07 Mar 2005
Posts: 27

PostPosted: Mon Mar 14, 2005 1:24 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   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