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 toggling a loop on/off with 1 hotkey

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





PostPosted: Sat Jun 09, 2007 5:48 pm    Post subject: Help toggling a loop on/off with 1 hotkey Reply with quote

if I try the following:

Code:

$F1::
loop{
F1::                           <<<ERROR ON THIS LINE
break

send ^v
send {enter}
}


I get the error "duplicate hotkey not allowed" or something similar. I can sorta understand why I get this error, but I cant get around it. All I would like to achieve is to switch a loop on/off by tapping F1. I'm stumped.

If anyone has any ideas please help me out here, thanks
Back to top
Micahs



Joined: 01 Dec 2006
Posts: 460

PostPosted: Sat Jun 09, 2007 6:40 pm    Post subject: Reply with quote

Try this:
Code:
SetTimer,looper,500   ;whatever rate you want
Return

looper:
   If(fOne)
   {   send ^v
      send {enter}
   }
Return

$F1::
   fOne := !fOne
Return

You are getting multiple hotkey errors because you are creating multiple references to F1::
_________________


Last edited by Micahs on Sat Jun 09, 2007 6:41 pm; edited 1 time in total
Back to top
View user's profile Send private message
jps



Joined: 02 Sep 2006
Posts: 279
Location: Scotland

PostPosted: Sat Jun 09, 2007 6:41 pm    Post subject: Reply with quote

GetKeyState
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Sat Jun 09, 2007 9:17 pm    Post subject: Reply with quote

Help with simple code: loop stop when key pressed.
Breaking an infinite loop with keypress
a bit of help pls
Disconinuing a loop and then again continue
a hotkey to stop current hotkey
Start and Stop
_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
AnthIste
Guest





PostPosted: Mon Jun 11, 2007 1:14 pm    Post subject: Reply with quote

thanx 4 all the help guys

Il try out all the suggestions and see what works
Back to top
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