Solved Need help with Autohotkey Windows
-
I want to try and make a macro but can't make Autohotkey do what I want.
Has anyone here experience with it?I want to reprogram Win+F1 to do Win+Tab, Tab, RightArrow, Enter
This is what I have but it doesn't work:
#F1:: #NoEnv #Warn SendMode Input Send, #{Tab}{Tab}{Right}{Enter} return
-
I figured it out.
It doesn't look like the comma matters one way or the other.But the problem was that in windows you can't just send all the keys at once because Win10 can't handle it. It might have to do with the fact that it's the Windows key or perhaps just sloppy programming from Microsoft.
With some delays it works though.
So when you press Win+F1 you get Win+Tab then another Tab, right arrow and Enter.
Basically it switches to the second virtual desktop in windows. The amount of right arrow presses will determine which virtual window get selected.#NoEnv #Warn #SingleInstance Force SendMode Event #F1:: Send #{Tab} Sleep 1000 Send {Tab} Sleep 50 Send {Right} Sleep 100 Send {Enter}
-
Sorry, but I'm an AutoIt user.
Does it do anything? Does AHK require a loop or anything to keep the script from exiting?
-
Haven’t used it in a bit. Used to use the Quake console. I’ll have a look it again
-
@Danp said in Need help with Autohotkey Windows:
Sorry, but I'm an AutoIt user.
Does it do anything? Does AHK require a loop or anything to keep the script from exiting?
You know, I just took AHK as it was the first thing I found, but I'm not married to it.
How would you do it in Autoit?
-
Looks like the comma after send.
-
I figured it out.
It doesn't look like the comma matters one way or the other.But the problem was that in windows you can't just send all the keys at once because Win10 can't handle it. It might have to do with the fact that it's the Windows key or perhaps just sloppy programming from Microsoft.
With some delays it works though.
So when you press Win+F1 you get Win+Tab then another Tab, right arrow and Enter.
Basically it switches to the second virtual desktop in windows. The amount of right arrow presses will determine which virtual window get selected.#NoEnv #Warn #SingleInstance Force SendMode Event #F1:: Send #{Tab} Sleep 1000 Send {Tab} Sleep 50 Send {Right} Sleep 100 Send {Enter}
-
So you're just switching between desktops? Win+ctrl is the shortcut for that.
-
@stacksofplates said in Need help with Autohotkey Windows:
So you're just switching between desktops? Win+ctrl is the shortcut for that.
Good catch! Yes, I'm just switching between desktops. Win+ctrl is similar to Alt+Tab in the way that it presents all the Virtual Desktops you have and then you have to click around or move around with the keyboard and select the one you want. That just takes too long.
I want to jump to any Virtual Desktop with just one key. So now I have Win+F1 for the first desktop, Win+F2 for the second, Win+F3 for the third and so on up to Win+F12.
This is a standard thing on linux as you can just set up a keyboard shortcut for every virtual desktop you have.
I thought I'll give it a shot with Windows built-in virtual desktop feature, but I'm not impressed. I haven't even found a way to see what virtual desktop I'm currently on.
-
@Pete-S said in Need help with Autohotkey Windows:
@stacksofplates said in Need help with Autohotkey Windows:
So you're just switching between desktops? Win+ctrl is the shortcut for that.
Good catch! Yes, I'm just switching between desktops. Win+ctrl is similar to Alt+Tab in the way that it presents all the Virtual Desktops you have and then you have to click around or move around with the keyboard and select the one you want. That just takes too long.
I want to jump to any Virtual Desktop with just one key. So now I have Win+F1 for the first desktop, Win+F2 for the second, Win+F3 for the third and so on up to Win+F12.
This is a standard thing on linux as you can just set up a keyboard shortcut for every virtual desktop you have.
I thought I'll give it a shot with Windows built-in virtual desktop feature, but I'm not impressed. I haven't even found a way to see what virtual desktop I'm currently on.
Ah I just got in the habit of win+ctrl and an arrow. Like ctrl+arrow on mac.
-
@stacksofplates said in Need help with Autohotkey Windows:
Ah I just got in the habit of win+ctrl and an arrow. Like ctrl+arrow on mac.
ctrl+alt+left (or right) arrow for me on a cinnamon desktop.
-
@JaredBusch said in Need help with Autohotkey Windows:
@stacksofplates said in Need help with Autohotkey Windows:
Ah I just got in the habit of win+ctrl and an arrow. Like ctrl+arrow on mac.
ctrl+alt+left (or right) arrow for me on a cinnamon desktop.
Yeah, that works fine if you only have two or maybe up to four. My preference is to have twelve though, so it's a just too slow to move between them one by one.
On linux I setup Ctrl+Alt+Fx shortcut to get to a particular one. I usually put the same thing in the same place so I know that Ctrl+Alt+F1 always get me to email, calendar etc.
The way of working fits with something like
screen
too when you're on ssh. Ctrl+A+0, Ctrl+A+1, Ctrl+A+2 etc.
Or Alt+Ctrl+F1, Alt+Ctrl+F2, Alt+Ctrl+F3 etc on the console.The Alt+drag is another thing I always miss on Windows as well.
-
@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
-
@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)