double click / double press on the key for different commands Topic is solved
-
- Posts: 26
- Joined: 25 Jan 2022, 10:24
double click / double press on the key for different commands
greetings everyone, can you please share any ideas on how to compose the script for this task:
___
given: standard W10 hotkey for switching VirtualDesktops
1) [Ctrl + WIN + right arrow] : move to next desktop
2) [Ctrl + WIN + left arrow] : move to previous desktop
___
what I want to do is not just re-map it to another key, but make it more elegant
Im looking for these options
1) to double-click [RShift] (similar like typical mouse double-click to open smth) for [Ctrl + WIN + right arrow]
2) and then to double-click again the same [RShift] for the opposite command [Ctrl + WIN + left arrow]
in simple words, when I need to move to next desktop - I double-click RSHift
When I need to go to the previous desktop - I double-click RShift again
is that even possible?
thanks
___
given: standard W10 hotkey for switching VirtualDesktops
1) [Ctrl + WIN + right arrow] : move to next desktop
2) [Ctrl + WIN + left arrow] : move to previous desktop
___
what I want to do is not just re-map it to another key, but make it more elegant
Im looking for these options
1) to double-click [RShift] (similar like typical mouse double-click to open smth) for [Ctrl + WIN + right arrow]
2) and then to double-click again the same [RShift] for the opposite command [Ctrl + WIN + left arrow]
in simple words, when I need to move to next desktop - I double-click RSHift
When I need to go to the previous desktop - I double-click RShift again
is that even possible?
thanks
Re: double click / double press on the key for different commands
Didn't test it since I don't have virtual desktops.
Code: Select all
~RShift Up::
ToggleVirtualDesktops() {
static toggle := 0
KeyWait RShift, D T0.3
if !ErrorLevel
send % "^#{" . ((toggle := !toggle) ? "Right" : "Left") . "}"
}
Last edited by amateur+ on 28 Jan 2022, 14:48, edited 1 time in total.
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
Re: double click / double press on the key for different commands Topic is solved
Another one:
Code: Select all
~RShift Up::Send % A_ThisHotkey != A_PriorHotkey || A_TimeSincePriorHotkey > 400
? "" : "#^" ((right := !right) ? "{Right}" : "{Left}")
-
- Posts: 26
- Joined: 25 Jan 2022, 10:24
Re: double click / double press on the key for different commands
greetings @amateur+ , thanks for your reply. Ve just tested the script, it does the job, but the new problem occurs - when switching to the next VirtualDesktop, the Start Menu opens up on that Desktop to I switched.
-
- Posts: 26
- Joined: 25 Jan 2022, 10:24
Re: double click / double press on the key for different commands
hi there @mikeyww , thank your for the reply. Your code works brilliantly! I tested it also for an issue that RShift not kept pressed when typing then, but it seems fine!
Much obliged
Much obliged
Re: double click / double press on the key for different commands
@mikeyww, seems like our solutions have one bug: they fail if the user quickly types something that contains another button between RShifts. For example RShift+D+RShift+R or quickly switches keyboard layout twice like RShift+AltRShift+Alt or RShift+CtrlRShift+Ctrl.
So we have to use Input to avoid this:
So we have to use Input to avoid this:
Code: Select all
~RShift::
ToggleVirtualDesktops() {
static toggle := 0
Input, key, L1 T0.4 V, {RShift}{LControl}{RControl}{LAlt}{RAlt}{LShift}{LWin}{RWin}{AppsKey}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BS}{CapsLock}{NumLock}{PrintScreen}{Pause}
if (ErrorLevel = "EndKey:RShift")
Send, % "^#{" . ((toggle := !toggle) ? "Right" : "Left") . "}"
}
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
-
- Posts: 26
- Joined: 25 Jan 2022, 10:24
Re: double click / double press on the key for different commands
hey @amateur+thank your for your contributing. Ive tried the latest script from you, maybe something wrong with W10 versions compatibility, IKD, Im running W10 ver 2004, and I haven't found the mistake you mention but still have the problem with Start Menu appears when toggling to next VirtualDesktop by pressing the RShift
Re: double click / double press on the key for different commands
You can try these variants:
or this:
As for that bug, just press quickly as you can RShift+M release both RShift. Has it switched you to another virtual desktop?
Code: Select all
~RShift::
ToggleVirtualDesktops() {
static toggle := 0
Input, key, L1 T0.3 V, {RShift}{LControl}{RControl}{LAlt}{RAlt}{LShift}{LWin}{RWin}{AppsKey}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BS}{CapsLock}{NumLock}{PrintScreen}{Pause}
if (ErrorLevel = "EndKey:RShift")
Send, % "{Blind}{RShift Up}#^{" . ((toggle := !toggle) ? "Right" : "Left") . "}"
}
Code: Select all
~RShift::
ToggleVirtualDesktops() {
static toggle := 0
Input, key, L1 T0.3 V, {RShift}{LControl}{RControl}{LAlt}{RAlt}{LShift}{LWin}{RWin}{AppsKey}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BS}{CapsLock}{NumLock}{PrintScreen}{Pause}
if (ErrorLevel = "EndKey:RShift")
Send, % "{Blind}{RShift Up}{RWin Down}{RCtrl Down}{" . ((toggle := !toggle) ? "Right" : "Left") . "}{RCtrl Up}{vkFF}{RWin Up}"
}
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
Re: double click / double press on the key for different commands
I've tested it right now with virtual desktops and both my scripts from the previous message don't reproduce your problem with Start Menu. Do you still have it?monatilda23 wrote: ↑28 Jan 2022, 15:26but still have the problem with Start Menu appears when toggling to next VirtualDesktop by pressing the RShift
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
-
- Posts: 26
- Joined: 25 Jan 2022, 10:24
Re: double click / double press on the key for different commands
hi there, if you dont mind I would test it tomorrow, as at the moment I have unstable system because I was testing millions of software and my PC lags so much. When I restore the PC I ll write you back if the problem persists, thanks
amateur+ wrote: ↑30 Jan 2022, 19:23I've tested it right now with virtual desktops and both my scripts from the previous message don't reproduce your problem with Start Menu. Do you still have it?monatilda23 wrote: ↑28 Jan 2022, 15:26but still have the problem with Start Menu appears when toggling to next VirtualDesktop by pressing the RShift