Down and left/right arrows to switch desktops

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
newlandzhang
Posts: 2
Joined: 28 Aug 2017, 20:01

Down and left/right arrows to switch desktops

Post by newlandzhang » 28 Aug 2017, 20:16

Hello, I downloaded autohotkey specifically for this but found this was more complicated that I thought... Anyways could someone help me make a script that switches to the previous desktop by pressing down and left together as well as switching to the next desktop by pressing down and right together? Thanks

User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Down and left/right arrows to switch desktops

Post by Exaskryz » 28 Aug 2017, 21:54

Combination hotkeys would be your Down & Left:: and Down & Right::. I don't have Windows 10, so I don't know how to switch Desktops. But try the Send command. You may need to run your script as an administrator. It may also just be a protected function that AHK can't emulate the hotkeys for. However, there may be a DllCall() that AHK can use; this would take the approach that AHK should mimic the actions of the native hotkeys for switching Desktops instead of triggering the native hotkeys. What that DllCall is, I don't know, and you may have to do googling for it in non-AHK resources.

If you can get it working, the way to preserve your Down key's functionality is with the ~ modifier. ~Down & Left::.

newlandzhang
Posts: 2
Joined: 28 Aug 2017, 20:01

Re: Down and left/right arrows to switch desktops

Post by newlandzhang » 28 Aug 2017, 22:20

Thanks for the reply, but I get an error saying that "Down & Left" is not a valid hotkey. I know now that I can remap the default desktop switch ("CTRL + WINDOW + RIGHT/LEFT) to other keys (right now it is "WINDOW + RIGHT/LEFT") but it would be better if I could switch desktops with one hand. Any other ideas?

User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Down and left/right arrows to switch desktops

Post by Exaskryz » 29 Aug 2017, 11:40

This code worked perfectly for me as a test: Down & Left::MsgBox Hi

Nightwolf85
Posts: 302
Joined: 05 Feb 2017, 00:03

Re: Down and left/right arrows to switch desktops

Post by Nightwolf85 » 29 Aug 2017, 13:53

This works for me as well:

Code: Select all

Down::Down ; Otherwise down alone doesn't work (will be fired on key release)
Down & Left::Send ^#{Left}
Down & Right::Send ^#{Right}

Post Reply

Return to “Ask for Help (v1)”