;#NoTrayIcon ;Assume we start up on desktop 1 and the user doesn't perform any manual switching. currentdesktop := 1 ;You can change the hotkeys for switching desktops below. ;Hotkeys WIN+[1-0] for switching desktops. #1::GotoDesktop(1) #2::GotoDesktop(2) #3::GotoDesktop(3) #4::GotoDesktop(4) #5::GotoDesktop(5) #6::GotoDesktop(6) #7::GotoDesktop(7) #8::GotoDesktop(8) #9::GotoDesktop(9) #0::GotoDesktop(10) GotoDesktop(desktop) { global currentdesktop desktopdiff := desktop - currentdesktop if (desktop > GetDesktopCount()) { ; The requested desktop is bigger than the number of desktops - create new desktops numDesktopsToCreate := desktop - GetDesktopCount() Loop %numDesktopsToCreate% { NewDesktop() } } if (desktopdiff < 0) { desktopdiff *= -1 Loop %desktopdiff% { Send ^#{Left} } } else if (desktopdiff > 0) { Loop %desktopdiff% { Send ^#{Right} } } currentdesktop := desktop } NewDesktop() { if (GetDesktopCount() > 9) { return } Send ^#d } GetDesktopCount() { ; In the registry, at Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VirtualDesktops ; The Key VirtualDesktopIDs contains the Internal IDs of all desktops RegRead, virtDesktopIDs, HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VirtualDesktops, VirtualDesktopIDs ; Each VirtualDesktopID is 32 characters long, dividing by 32 gives the number Return StrLen(virtDesktopIDs)/32 }