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 

other keys stoping the loop key

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



Joined: 08 Jan 2010
Posts: 2

PostPosted: Fri Jan 08, 2010 4:30 pm    Post subject: other keys stoping the loop key Reply with quote

my .ahk is something like this
Code:

F1::
SetKeyDelay, 0

loop,1
{
ControlSend, , {F1}, ahk_id %active_id8%
MouseClick, left
}
return

when i hold F1 its all working ok, but if i'm still holding the key and i press another, it stops working
i want to keep it working while the f1 key is in hold and others keys dont stop the script

something like press and hold f1, then i press f5 = the result i want: f1 is still in loop and i get the f5 as i normally would

thank you[/code]
Back to top
View user's profile Send private message
ribbs2521



Joined: 28 Sep 2007
Posts: 273
Location: New York

PostPosted: Fri Jan 08, 2010 4:36 pm    Post subject: Reply with quote

I think this should work

Code:
F1::
  Loop
  {
    ControlSend, {F1}, ahk_id %active_id8%
    MouseClick, Left
    if (!GetKeyState("F1"))
      break
  }
  return


your loop is pointless in your sub, by holding the key you are just calling the routine as the key is being held down just as you can hold the a key to do aaaaaaaaaaaaaaaaaaaaaa. You could take the loop out and it would act exactly the same.

This will start a loop but only end it when you release the F1 key

EDIT: You may want to put a sleep in there as this one won't depend on set key delay.
Back to top
View user's profile Send private message
StillChilly
Guest





PostPosted: Fri Jan 08, 2010 5:16 pm    Post subject: Reply with quote

Hotkeys page in the documentation wrote:
Quote:
* Wildcard: Fire the hotkey even if extra modifiers are being held down. This is often used in conjunction with remapping keys or buttons. For example:

*#c::Run Calc.exe ; Win+C, Shift+Win+C, Ctrl+Win+C, etc. will all trigger this hotkey.
*ScrollLock::Run Notepad ; Pressing Scrolllock will trigger this hotkey even when modifer key(s) are down.This symbol is ignored on Windows 95/98/ME.
Back to top
hotkey



Joined: 08 Jan 2010
Posts: 2

PostPosted: Fri Jan 08, 2010 5:33 pm    Post subject: Reply with quote

both *F1 and the ribbs solution didnt work

i want to keep f1 working and also be able to press other keys
Back to top
View user's profile Send private message
jl34567



Joined: 03 Jan 2010
Posts: 262

PostPosted: Fri Jan 08, 2010 7:22 pm    Post subject: Reply with quote

hotkey wrote:
both *F1 and the ribbs solution didnt work

i want to keep f1 working and also be able to press other keys


This is exactly what I used and it works......also requires both be held down so that you can use both keys still and not kill the loop.

Code:
GetKeyState, state1, 1
GetKeystate, state2, 2
if state1=D
{
if state2=D
break


Hope this helps.
Back to top
View user's profile Send private message AIM Address
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