AutoHotkey Community

It is currently May 27th, 2012, 1:11 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: January 8th, 2010, 5:30 pm 
Offline

Joined: January 8th, 2010, 5:25 pm
Posts: 2
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]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2010, 5:36 pm 
Offline

Joined: September 28th, 2007, 3:56 am
Posts: 279
Location: New York
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2010, 6:16 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2010, 6:33 pm 
Offline

Joined: January 8th, 2010, 5:25 pm
Posts: 2
both *F1 and the ribbs solution didnt work

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2010, 8:22 pm 
Offline

Joined: January 3rd, 2010, 6:33 am
Posts: 262
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Leef_me, Ohnitiel and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group