Hello,
how can I use Hotkey with KeyNames ~LShift/LShift Up and a function call as Label? And modifier Shift should be processed by the active app as usual.
Many thanks and greetings
hotkeyguy
Hotkey: Using ~LShift/LShift Up + function call Topic is solved
Re: Hotkey: Using ~LShift/LShift Up + function call
What is an example of what you want to achieve?
Re: Hotkey: Using ~LShift/LShift Up + function call
...Wrong button, too fast...
Hello mikeyww,
I want to switch the mode of AHK-scripts depending of pressed modifier keys (Shift, Ctrl and Alt) and their combinations (e. g.Shift+Ctrl). The corresponing AHK GUI must change after any of the modifier keys is pressed. Thats means when I press Shift first, the mode is KB__Mod_Shift (first GUI change) and when I then press additionally Ctrl the mode is KB__Mod_ShiftCtrl (second GUI change). Because I want to change the GUIs dynamically, I can't use GetKeyState().
In more detail I want to differentiate between the left and right modifier keys, but that's the next step.
I have seen your code snippet, many thanks. After my comprehensive tests I think it's easier to use use Hotkey because I can disable/enable the hotkeys as needed. KeyWait blocks the other possible modifier keys.
Many thanks and greetings
hotkeyguy
Hello mikeyww,
I want to switch the mode of AHK-scripts depending of pressed modifier keys (Shift, Ctrl and Alt) and their combinations (e. g.Shift+Ctrl). The corresponing AHK GUI must change after any of the modifier keys is pressed. Thats means when I press Shift first, the mode is KB__Mod_Shift (first GUI change) and when I then press additionally Ctrl the mode is KB__Mod_ShiftCtrl (second GUI change). Because I want to change the GUIs dynamically, I can't use GetKeyState().
In more detail I want to differentiate between the left and right modifier keys, but that's the next step.
I have seen your code snippet, many thanks. After my comprehensive tests I think it's easier to use use Hotkey because I can disable/enable the hotkeys as needed. KeyWait blocks the other possible modifier keys.
Many thanks and greetings
hotkeyguy
Last edited by hotkeyguy on 29 Nov 2021, 16:26, edited 1 time in total.
Re: Hotkey: Using ~LShift/LShift Up + function call Topic is solved
This hotkey routine will execute each time you press one of the hotkeys. The new key press will interrupt the previously running routine. It is just a demonstration. You can adjust it to meet your needs.
Code: Select all
~*LShift::
~*LCtrl::
mode := mode()
KeyWait, LShift
KeyWait, LCtrl
ToolTip, %mode%
Return
mode() {
Return GetKeyState("LCtrl", "P") + 2 * GetKeyState("LShift", "P")
}
Re: Hotkey: Using ~LShift/LShift Up + function call
I have edited my example!
Re: Hotkey: Using ~LShift/LShift Up + function call
It looks like you are on your way to success. Instead of editing earlier posts in response to later ones, you can just put your new reply in a new reply. It makes the thread easier to follow.
Re: Hotkey: Using ~LShift/LShift Up + function call
Based on your example...
...but I would really like to know how I can use Hotkey with ~LShift/LShift U!
Code: Select all
~*LShift::
~*LCtrl::
sMode := Mode()
ToolTip, % "ModeDown (" sMode ")"
KeyWait, LShift
KeyWait, LCtrl
return
*LShift Up::
*LCtrl Up::
sMode := Mode()
ToolTip, % "ModeUp (" sMode ")"
KeyWait, LShift
KeyWait, LCtrl
return
Mode() {
return GetKeyState("LCtrl", "P") + 2 * GetKeyState("LShift", "P")
}
Who is online
Users browsing this forum: Chunjee, Google [Bot] and 133 guests