• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
TRIGGERcmd
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Press the Down Arrow key (or any other key)

Windows
17
40
15.2k
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.
  • R
    Russ @Jcjcc
    last edited by Mar 24, 2020, 6:24 PM

    @Jcjcc, tell me more - what are you trying to accomplish?

    Russell VanderMey

    1 Reply Last reply Reply Quote 0
    • D
      Daniel Millan
      last edited by May 30, 2020, 12:26 AM

      Can I run this in a background command?

      R 1 Reply Last reply May 30, 2020, 12:29 AM Reply Quote 0
      • R
        Russ @Daniel Millan
        last edited by Russ May 30, 2020, 12:32 AM May 30, 2020, 12:29 AM

        @Daniel-Millan, you could, but it wouldn't do any good. The command would run, but as Local System, not the user, so it wouldn't press any buttons for the logged in user.

        If you make it a foreground command it might do what you're trying to accomplish though - you don't actually see the command running, you just see the results of the button(s) being pressed.

        Russell VanderMey

        D 1 Reply Last reply May 30, 2020, 12:33 AM Reply Quote 0
        • D
          Daniel Millan @Russ
          last edited by May 30, 2020, 12:33 AM

          @Russ I want to run it before I am logged into the computer.

          R 1 Reply Last reply May 30, 2020, 12:54 AM Reply Quote 0
          • R
            Russ @Daniel Millan
            last edited by May 30, 2020, 12:54 AM

            @Daniel-Millan, don't think that's possible.

            Russell VanderMey

            D 1 Reply Last reply May 30, 2020, 1:03 AM Reply Quote 0
            • D
              Daniel Millan @Russ
              last edited by May 30, 2020, 1:03 AM

              @Russ
              Okay, thanks.

              R 1 Reply Last reply May 30, 2020, 1:06 AM Reply Quote 0
              • R
                Russ @Daniel Millan
                last edited by Russ May 30, 2020, 1:07 AM May 30, 2020, 1:06 AM

                @Daniel-Millan, sorry. I think it would be a security flaw to allow any process to simulate key presses at that point. That said, there might be some way to do it.

                Russell VanderMey

                1 Reply Last reply Reply Quote 0
                • J
                  João Paulo Pugialli
                  last edited by Jun 30, 2020, 9:00 PM

                  Hello,

                  Do you know if it is possible to press a F-media key? For example, I wanted to make alexa press f9 key because that is my shorcut for keyboard lights off. I tried this code:

                  Set WshShell = WScript.CreateObject("WScript.Shell")
                  WshShell.SendKeys "{F9}"

                  But it just keeps pressing numlock.

                  Regards,

                  R 1 Reply Last reply Jun 30, 2020, 10:29 PM Reply Quote 0
                  • R
                    Russ @João Paulo Pugialli
                    last edited by Jun 30, 2020, 10:29 PM

                    @João-Paulo-Pugialli, according to this article, {F9} is correct, so maybe your keyboard is doing something in hardware to toggle its own light off.
                    https://social.technet.microsoft.com/wiki/contents/articles/5169.vbscript-sendkeys-method.aspx

                    Russell VanderMey

                    R 1 Reply Last reply Jul 25, 2020, 1:37 PM Reply Quote 1
                    • R
                      Russ @Russ
                      last edited by Russ Jul 25, 2020, 1:38 PM Jul 25, 2020, 1:37 PM

                      FYI, I found that Wsh.SendKeys can't do ALT+1 (or any other digit), but I was able to make it work with this AutoHotKey script.

                      Send, !1
                      

                      ! means hold the ALT key (while pressing 1). You can see examples like this in the Tutorial page in AutoHotKey's help.

                      My TRIGGERcmd command is this: start d:\tools\AutoHotKey\pressAlt1.ahk

                      Let me know if you need me to do a video on this.

                      Russell VanderMey

                      1 Reply Last reply Reply Quote 0
                      • G
                        Gerfesson Alves de Oliveira
                        last edited by Aug 7, 2020, 12:07 AM

                        How could I press windows key + "P" so I can open up the projection options?

                        R 1 Reply Last reply Aug 7, 2020, 8:19 PM Reply Quote 0
                        • R
                          Russ @Gerfesson Alves de Oliveira
                          last edited by Russ Aug 7, 2020, 8:20 PM Aug 7, 2020, 8:19 PM

                          @Gerfesson-Alves-de-Oliveira, for this one I'd use AutoIT.

                          I like AutoIT because it can do almost anything in Windows, and it allows you to compile your script to a stand-alone .EXE file. After you install it, look for SciTE Script Editor, that's the actual AutoIT script editor.

                          You can see here how simple it is to make an AutoIT script that presses Windows+P:

                          Send("{LWINDOWN}") ; Holds the Windows key down
                          Send("{p}")       ; Presses the p key
                          Send("{LWINUP}") ; Releases the Windows key
                          

                          This is a good reference page for pressing keys: https://www.autoitscript.com/autoit3/docs/appendix/SendKeys.htm

                          Russell VanderMey

                          G T 2 Replies Last reply Aug 8, 2020, 2:58 AM Reply Quote 0
                          • G
                            Gerfesson Alves de Oliveira @Russ
                            last edited by Aug 8, 2020, 2:58 AM

                            @Russ , I found a way thru your guidence!! Thanks a lot!

                            The whole au3 document was this:

                            Send("{LWINDOWN}") ; Holds the Windows key down
                            Send("{p}") ; Presses the p key
                            Send("{LWINUP}") ; Releases the Windows key
                            sleep (500)
                            Send("{UP}") ; Presses Up arrow
                            Send("{ENTER}") ; Presses Enter
                            sleep(500)
                            ShellExecute("C:\Users\nosse\AppData\Local\Programs\Opera GX\launcher.exe")
                            ShellExecute("https://www.primevideo.com")
                            ShellExecute("https://www.netflix.com")
                            sleep (2000)
                            Send("^{TAB}") ; Presses Shift + Tab
                            Send("{CTRLDOWN}") ; Holds the CTRL key down
                            Send("{w}") ; Presses the w key
                            Send("{CTRLUP}") ; Releases the CTRL key
                            sleep (300)
                            Send("{ENTER}") ; Presses Enter
                            Send("{LWINDOWN}") ; Holds the Windows key down
                            Send("{SHIFTDOWN}") ; Holds the Left Shift key down
                            Send("{RIGHT}") ; Presses Right arrow
                            Send("{SHIFTUP}") ; Releases the Shift key
                            Send("{LWINUP}") ; Releases the Windows key

                            With this code I change the screen mode to extend the for my projector, open up a new opera window with netflix and prime video, close the opera's welcome window and finally put this new openned window to the second screen!

                            Now I'm going to do the reverse engineering! Thanks a lot once again

                            R 1 Reply Last reply Aug 8, 2020, 12:31 PM Reply Quote 0
                            • R
                              Russ @Gerfesson Alves de Oliveira
                              last edited by Aug 8, 2020, 12:31 PM

                              @Gerfesson-Alves-de-Oliveira, nice job!

                              I hope you do a youtube video showing it off.

                              Russell VanderMey

                              1 Reply Last reply Reply Quote 0
                              • Andoni CantónA
                                Andoni Cantón
                                last edited by Oct 19, 2020, 3:02 PM

                                how can I make it press the spacebar? I'm trying to get it to play or pause netflix or youtube

                                R 1 Reply Last reply Oct 19, 2020, 10:06 PM Reply Quote 0
                                • R
                                  Russ @Andoni Cantón
                                  last edited by Oct 19, 2020, 10:06 PM

                                  @Andoni-Cantón said in Press the Down Arrow key (or any other key):

                                  space

                                  @Andoni-Cantón, for space, you can use this script:

                                  Dim Wsh
                                  Set Wsh = Wscript.CreateObject("Wscript.Shell")
                                  Wsh.SendKeys " "
                                  

                                  You can run the script with this command:

                                  wscript c:\scripts\space.vbs
                                  

                                  Russell VanderMey

                                  Teo castrejon escamillaT 1 Reply Last reply Jan 23, 2022, 10:47 PM Reply Quote 0
                                  • T
                                    Tribo @Russ
                                    last edited by Oct 23, 2020, 7:22 PM

                                    @Russ said in Press the Down Arrow key (or any other key):

                                    @Gerfesson-Alves-de-Oliveira, for this one I'd use AutoIT.

                                    I like AutoIT because it can do almost anything in Windows, and it allows you to compile your script to a stand-alone .EXE file. After you install it, look for SciTE Script Editor, that's the actual AutoIT script editor.

                                    You can see here how simple it is to make an AutoIT script that presses Windows+P:

                                    Send("{LWINDOWN}") ; Holds the Windows key down
                                    Send("{p}")       ; Presses the p key
                                    Send("{LWINUP}") ; Releases the Windows key
                                    

                                    This is a good reference page for pressing keys: https://www.autoitscript.com/autoit3/docs/appendix/SendKeys.htm

                                    I added:

                                    Send("{LWINDOWN}") ; Holds the Windows key down
                                    Send("{p}") ; Presses the p key
                                    Send("{LWINUP}") ; Releases the Windows key
                                    Send("{DOWN}")
                                    Send("{DOWN}")
                                    Send("{ENTER}")

                                    but it didn't happen as expected (using AutoIt's F5), it applies the three commands in AutoIt's own window.

                                    it's the first time I've seen and dealt with it, so sorry for any silly question.

                                    R 1 Reply Last reply Oct 23, 2020, 10:14 PM Reply Quote 0
                                    • R
                                      Russ @Tribo
                                      last edited by Oct 23, 2020, 10:14 PM

                                      @Tribo, with AutoIT you can compile an EXE, and when you run the exe via TRIGGERcmd, the keys will be pressed in whatever the current application happens to be. You can also have AutoIT activate a particular Window first.

                                      https://www.autoitscript.com/autoit3/docs/functions/WinActivate.htm

                                      Russell VanderMey

                                      1 Reply Last reply Reply Quote 0
                                      • Arthur NeufeldA
                                        Arthur Neufeld
                                        last edited by Arthur Neufeld Jan 20, 2021, 9:41 PM Jan 20, 2021, 9:40 PM

                                        I really don't know what I did wrong.

                                        They only thing I want is to let Triggercmd press F7.

                                        I created a vbs file with

                                        Dim Wsh
                                        Set Wsh = Wscript.CreateObject("Wscript.Shell")
                                        Wsh.SendKeys "{F7}"
                                        

                                        in it. Safed it at

                                        c:\scripts\key.vbs
                                        

                                        Then I wrote this into the "Command" line: in TRIGGERcmd

                                        wscript c:\scripts\key.vbs
                                        

                                        Even if I ope the File manually it doesn't press F7. I have to say, I'm really new to this topic.
                                        What did I do wrong?

                                        Cheers
                                        Arthur

                                        R 1 Reply Last reply Jan 20, 2021, 11:08 PM Reply Quote 0
                                        • R
                                          Russ @Arthur Neufeld
                                          last edited by Jan 20, 2021, 11:08 PM

                                          @Arthur-Neufeld, that should work. It worked for me. Can you show me a screenshot of your command?

                                          Mine looks like this:

                                          4b240459-5018-466b-be24-fa912d50231b-image.png

                                          Also, does it work if you run the command from a cmd prompt?

                                          Russell VanderMey

                                          Arthur NeufeldA 1 Reply Last reply Jan 26, 2021, 6:29 PM Reply Quote 0
                                          • First post
                                            Last post