AutoHotkey Community

It is currently May 27th, 2012, 10:56 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: January 8th, 2007, 12:46 am 
Offline

Joined: October 4th, 2006, 12:26 am
Posts: 2
Just as what "google desktop search" does. If Ctrl + Ctrl is not possible, how about to define pressing Ctrl or Shift for centail time like 10 seconds as hot key?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2007, 12:59 am 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
Just to clarify, you want to press Control twice quickly, just as if you were double-clicking the mouse? If so, try this:

Code:
~Ctrl::
;400 is the maximum allowed delay (in milliseconds) between presses.
if (A_PriorHotKey = "~Ctrl" AND A_TimeSincePriorHotkey < 400)
{
   ;Put code to be executed here.
   Msgbox,Double press detected.
}
Sleep 0
KeyWait Ctrl
return


Alternatively, did you want to hold one Control, and then press the one on the other side? Here's a simple hotkey combination that captures that:

Code:
~LCtrl & RCtrl::
~RCtrl & LCtrl::
Msgbox,Pressed both control keys.
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 8th, 2007, 1:34 am 
Offline

Joined: October 4th, 2006, 12:26 am
Posts: 2
Thank you. It works. I modify it to let it works with Windows Desktop Search.

~LControl::
if (A_PriorHotkey <> "~LControl" or A_TimeSincePriorHotkey > 400)
{
; Too much time between presses, so this isn't a double-press.
KeyWait, LControl
return
}
;MsgBox You double-pressed the right control key.
Send,^!m
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 16th, 2009, 1:58 am 
This code doesn't work quite right. If you hold the button down it is detected as a double-press when really its not. How can I fix it?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2011, 6:35 am 
What if you wanted to do the other way around? I.E. assign the caps lock key to ctrl + ctrl.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2011, 9:49 am 
Offline

Joined: January 3rd, 2010, 6:33 am
Posts: 262
ahkahkahk wrote:
This code doesn't work quite right. If you hold the button down it is detected as a double-press when really its not. How can I fix it?

Try adding a Keywait up.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 23rd, 2011, 11:23 am 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
j33ry you want a double press of Ctrl to toggle Capslock?
Code:
~LControl::
if (A_PriorHotkey <> "~LControl" or A_TimeSincePriorHotkey > 400)
{
; Too much time between presses, so this isn't a double-press.
KeyWait, LControl
return
}
SetCapsLockState , % GetKeyState("CapsLock","t") ? "Off" : "On" ;toggle capslock
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 25th, 2011, 10:09 pm 
what if I want the system to input ctrl + ctrl by pressing the caps lock key?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: May 25th, 2011, 10:13 pm 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
That is much easier
Code:
Capslock::Send {Ctrl 2}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2011, 1:28 am 
Offline

Joined: November 24th, 2011, 1:25 am
Posts: 1
How about if I wanted a double press of the "v" key to send a "right ALT"?

Thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2011, 6:36 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Code:
~Ctrl::RapidHotkey("Label1""Label2",2,0.15,"1""1") ; www.autohotkey.com/forum/viewtopic.php?t=38795
Label1:
MsgBox Pressed Ctrl twice
Return
Label2:
MsgBox Pressed Ctrl 3 times
Return
v+v = RAlt
Code:
~v::RapidHotkey("{LAlt}")

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, HotkeyStick and 16 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