ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Solved Need help with Autohotkey Windows

    IT Discussion
    autohotkey
    5
    13
    708
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • 1
      1337
      last edited by 1337

      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
      
      nadnerBN 1 Reply Last reply Reply Quote 1
      • 1
        1337
        last edited by 1337

        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}
        
        1 Reply Last reply Reply Quote 1
        • DanpD
          Danp
          last edited by

          Sorry, but I'm an AutoIt user. 😛

          Does it do anything? Does AHK require a loop or anything to keep the script from exiting?

          1 1 Reply Last reply Reply Quote 1
          • nadnerBN
            nadnerB
            last edited by nadnerB

            Haven’t used it in a bit. Used to use the Quake console. I’ll have a look it again

            1 Reply Last reply Reply Quote 0
            • 1
              1337 @Danp
              last edited by

              @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?

              1 Reply Last reply Reply Quote 0
              • nadnerBN
                nadnerB @1337
                last edited by nadnerB

                Looks like the comma after send.

                1 Reply Last reply Reply Quote 1
                • 1
                  1337
                  last edited by 1337

                  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}
                  
                  1 Reply Last reply Reply Quote 1
                  • stacksofplatesS
                    stacksofplates
                    last edited by

                    So you're just switching between desktops? Win+ctrl is the shortcut for that.

                    1 1 Reply Last reply Reply Quote 1
                    • 1
                      1337 @stacksofplates
                      last edited by 1337

                      @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.

                      stacksofplatesS 1 Reply Last reply Reply Quote 0
                      • stacksofplatesS
                        stacksofplates @1337
                        last edited by

                        @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.

                        JaredBuschJ 1 Reply Last reply Reply Quote 0
                        • JaredBuschJ
                          JaredBusch @stacksofplates
                          last edited by

                          @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.

                          1 1 Reply Last reply Reply Quote 0
                          • 1
                            1337 @JaredBusch
                            last edited by 1337

                            @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.

                            1 Reply Last reply Reply Quote 0
                            • DanpD
                              Danp
                              last edited by Danp

                              @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

                              1 1 Reply Last reply Reply Quote 1
                              • 1
                                1337 @Danp
                                last edited by 1337

                                @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)
                                
                                1 Reply Last reply Reply Quote 2
                                • 1 / 1
                                • First post
                                  Last post