Hi awesome people ,
Could you please kindly help me?
Could you please help me with a codes (or if you don't have time, a link for what to read specifically to do this:) so that:
For a key (say, F3):
1. While being pressed, it will stop mouse movement (so I can re-position my mouse without have to lift it up the mouse mat). And If I press another key while being pressed, it will do something else, say writing my email address automatically.
2. If I release quickly like a normal keypress action (without pressing any other key), it will send "Enter".
(3. And when I release, it will of course resume normal mouse movement.)
Thank you very much! <3
Different output depends on how long to hold a key
Different output depends on how long to hold a key
*** Thank you for reading. I am not in coding and know almost nothing about professional coding, hope for your patience and deeply appreciate any of your kind helps. My current interest in this awesome AHK is due to that my work is graphical ((architect/CAD) and, to reduce strains, my right hand is better off not leaving the mouse (an MMO mouse that has 12 side keys which I maps a lot of F keys and other keys in) as much as possible. All the best you lovely coders! ***
- WarlordAkamu67
- Posts: 220
- Joined: 21 Mar 2023, 06:52
Re: Different output depends on how long to hold a key
@akirofe This will make F3 send Enter on a press, and block mouse movement on a hold. While holding F3, the keys "a", "b", and "c" can be used to display a MsgBox- alter to your liking.
Code: Select all
#Requires AutoHotkey v2.0
key_is_Held := 0
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
multiKey() {
if (GetKeyState("F3", "P")) {
BlockInput("MouseMove")
global key_is_Held := 1
while (GetKeyState("F3", "P")) {
Sleep(100)
}
global key_is_Held := 0
BlockInput("MouseMoveOff")
} else {
Send("{Enter}")
}
return
}
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
F3:: {
SetTimer(multiKey, -200)
KeyWait("F3")
return
}
; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ; ------------------------- ;
#HotIf (key_is_Held)
a:: {
MsgBox("Extra Function on F3 + a")
return
}
b:: {
MsgBox("Extra Function on F3 + b")
return
}
c:: {
MsgBox("Extra Function on F3 + c")
return
}
Re: Different output depends on how long to hold a key
Wow... Thank you very much WarlordAkamu67 !!! I'll apply and will report back!!! Have a wonderful day WarlordAkamu67 !!
*** Thank you for reading. I am not in coding and know almost nothing about professional coding, hope for your patience and deeply appreciate any of your kind helps. My current interest in this awesome AHK is due to that my work is graphical ((architect/CAD) and, to reduce strains, my right hand is better off not leaving the mouse (an MMO mouse that has 12 side keys which I maps a lot of F keys and other keys in) as much as possible. All the best you lovely coders! ***
Who is online
Users browsing this forum: Felix Siano, Google [Bot] and 59 guests