@Danp said in Need help with Autohotkey Windows:
@Pete-S Seems like someone already created the script for you -- https://www.computerhope.com/tips/tip224.htm
Edit: The above is based on this -- https://github.com/pmb6tz/windows-desktop-switcher
Thanks @Danp !
I had a look and it's complicated because you need DLLs and whatnot just to figure out which Desktop you are actually on. But then the script just runs Ctrl+Win+arrow to switch to the right Desktop.
So I borrowed that little bit but the rest went into the bin. I just run enough Ctrl+Win+Left_arrow to make sure I'm on the first desktop and then go from there.
This is what I have now (it assumes 8 virtual desktops present and uses Win+F1 to Win+F8 to switch between them):
#NoEnv
#Warn
#SingleInstance Force
SendMode Event
SetVirtualDesktop(DesktopNumber)
{
Sleep 100
Send #^{Left 8}
if (DesktopNumber>0) {
Sleep 100
Send #^{Right %DesktopNumber%}
}
}
#F1::SetVirtualDesktop(0)
#F2::SetVirtualDesktop(1)
#F3::SetVirtualDesktop(2)
#F4::SetVirtualDesktop(3)
#F5::SetVirtualDesktop(4)
#F6::SetVirtualDesktop(5)
#F7::SetVirtualDesktop(6)
#F8::SetVirtualDesktop(7)