Struggling with Windows Key to switch between virtual desktops

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
AlanJuina
Posts: 8
Joined: 08 Apr 2023, 05:37

Struggling with Windows Key to switch between virtual desktops

Post by AlanJuina » 07 Nov 2023, 10:47

I want to use the shortcuts to switch between virtual desktops, but my keyboard doesn't have any windows Key.
here are the official shortcuts : press Windows+Ctrl+Left Arrow to switch to a lower-numbered desktop or Windows+Ctrl+Right Arrow for a higher-numbered one

First I want to assign the ''ScrollLock'' key to the Windows key, but it doesn't work at all

Code: Select all

KeyHistory
ScrollLock::
{
    send {RWin}
}
Error: Missing "propertyname:" in object literal.

001: KeyHistory()
003: {
▶ 004: send({RWin})
005: }

which sould be fine since I was careful to put RWin inside curly brackets.


Second I want to replace 'Windows+Ctrl+Left Arrow' with "ScrollLock+1" and "Windows+Ctrl+Right Arrow" with "ScrollLock+2", but how do I do this?

User avatar
boiler
Posts: 17173
Joined: 21 Dec 2014, 02:44

Re: Struggling with Windows Key to switch between virtual desktops

Post by boiler » 07 Nov 2023, 12:12

From your prior posts, it does appear that you are using v2, so you need to quote literal strings:

Code: Select all

Send '{RWin}'

But sending and releasing the RWin key isn't going to accomplish much. It seems you want a key remap, which is different:

Code: Select all

ScrollLock::RWin

But be careful about using the "Lock" types of keys for purposes like that. It might work, but if it doesn't, test with another key.

AlanJuina
Posts: 8
Joined: 08 Apr 2023, 05:37

Re: Struggling with Windows Key to switch between virtual desktops

Post by AlanJuina » 08 Dec 2023, 04:45

your remapping works well for the window key. Can you explain the difference between remapping and ''send''. Why would ''send'' not work for the window key?

User avatar
boiler
Posts: 17173
Joined: 21 Dec 2014, 02:44

Re: Struggling with Windows Key to switch between virtual desktops

Post by boiler » 08 Dec 2023, 05:19

If you just simply Send a key, you’re not telling it to hold it down and wait to release it when you release the assigned hotkey or anything like that. You’re just telling it to send and release it immediately. A remap makes one key behave like another, so if you hold the physical key down, the key that is mapped to it is also held down.

Post Reply

Return to “Ask for Help (v2)”