Hi,
I'd appreciate help.
How to set the same shortcut ^q to send one command when single pressing, and another when holding ^ and pressing q twice?
Thank you very much!
How to set same shortcut (^q) to send one command when single pressing, and another when holding ^ and pressing q twice? Topic is solved
- flyingDman
- Posts: 2817
- Joined: 29 Sep 2013, 19:01
Re: How to set same shortcut (^q) to send one command when single pressing, and another when holding ^ and pressing q tw
search for Morse()
14.3 & 1.3.7
Re: How to set same shortcut (^q) to send one command when single pressing, and another when holding ^ and pressing q tw Topic is solved
Try this.
If you press Ctrl + Q twice within 300 milliseconds, the MsgBox will show different text.
But if you need the single press mode, than you will need to press Ctrl + Q, release it, and wait for 300 milliseconds.
If you press Ctrl + Q twice within 300 milliseconds, the MsgBox will show different text.
But if you need the single press mode, than you will need to press Ctrl + Q, release it, and wait for 300 milliseconds.
Code: Select all
#MaxThreadsPerHotkey, 2
KeyPress := 0, running := False
^q::
KeyPress++
If (running = True) {
Return
}
running := True
While (A_TimeSinceThisHotkey < 300) {
If (KeyPress > 1) {
MsgBox, Two times
KeyPress := 0, running := False
Return
}
}
MsgBox, One time
KeyPress := 0, running := False
Return
Re: How to set same shortcut (^q) to send one command when single pressing, and another when holding ^ and pressing q tw
Many thanks you all for the replies.
I'm going to explore Morse(), and Ridwan's script also works perfectly, fitting all I needed!
I further question if I may. Regarding the heading of the script:
Since I'm going to use this script to run several commands stored within a single .ahk file, should I repeat that heading for each individual script within the file, or could I insert the heading once, just in the beginning of the script?
Thank you very much!
I'm going to explore Morse(), and Ridwan's script also works perfectly, fitting all I needed!
I further question if I may. Regarding the heading of the script:
Code: Select all
#MaxThreadsPerHotkey, 2
KeyPress := 0, running := False
Thank you very much!
Re: How to set same shortcut (^q) to send one command when single pressing, and another when holding ^ and pressing q tw
Code: Select all
#MaxThreadsPerHotkey, 2
Code: Select all
KeyPress := 0, running := False
Code: Select all
KeyPress_K := 0, running_K := False
Re: How to set same shortcut (^q) to send one command when single pressing, and another when holding ^ and pressing q tw
Thank you very much for the script and the teaching @Ridwan !
Who is online
Users browsing this forum: doodles333, Frogrammer and 268 guests