amateur+ wrote: ↑17 Jan 2022, 18:34
Have killed almost two hours on your task.
Code: Select all
$vkC0::
SetKeyDelay -1
Send {LWin Down}
return
#vkC0::return
#vkC0 up::
vkC0 up::
SetKeyDelay -1
if (A_PriorKey = "``")
Send {Esc}{LWin up}{vkC0}
else Send {LWin up}
return
I apologize that it took me so many days to respond.
Thank you very much for the code and the time you put in.
In the vast majority of cases, this code works fine. However, when the ` key is pressed alone, you cancel the previously pressed LWin via the ESC key, which is a more subtle way to do it, but it also makes the ESC key be entered in.
For example, when typing ` in cmd, it triggers the ESC key, causing the current line of typed text to be cleared. In some games, it can cause similar trouble.
So my previous code tried to make sure that ` was triggering LWin when pressed along with another key.
I tried to change my previous code. Now my code works fine in most cases. However, there is a flaw: when I press ` and another key, that key gets keyed in. Do you have any suggestions?
Code: Select all
#InstallKeybdHook
$`::
SetKeyDelay -1
state := GetKeyState("``","P")
triggered := 0
new_trigger := 0
Loop{
state := GetKeyState("``","P")
if (state = 0){
break
}
key := A_PriorKey
if (key = "" Or key = "``"){
new_trigger := 1
}
if (key != "``" And key != "" And new_trigger = 1){
key_holding := GetKeyState(key,"P")
if (triggered =0){
Send {LWin Down}
sleep 50
if (key_holding = 0){
Send {%key%}
}
triggered := 1
}
}
}
if (triggered = 0){
Send {vkC0}
}else{
Send {LWin Up}
}
Return