Press the Down Arrow key (or any other key)
-
How would I do something like Ctrl+Tab?
-
@kellanist, in theory this script would do it, but I don't have any app that would respond to CTRL-TAB, so I didn't test it.
Dim Wsh Set Wsh = Wscript.CreateObject("Wscript.Shell") Wsh.SendKeys "^{TAB}"
-
@Russ Chrome!
Ctrl+tab = move to the next tab to the right.
Ctrl+Shift+Tab = move to the previous tab to the left.
Crtl+W = close tab.I use those programmed into my mouse to navigate around the browser.
-
@kellanist, duh, I use that CTRL-TAB key combo in chrome. It just didn't register in my brain.
Anyway, I just tested it from my phone and it worked for me - my PC switched chrome tabs when I ran it. Let me know if it works for you please.
-
This post is deleted! -
@Russ Ctrl+tab and Ctrl+Shift+Tab work perfectly.
Ctrl+W for some odd reason causes Chome to close entirely instead of just closing a tab.
I've tried "^(W)" and "^W" and they both close the window instead of a single tab. I'm a bit confused as to what is going.
One other thing. Tried to setup Alt+Tab for switching windows and it works but triggers NUM lock for some odd reason. Using "%{TAB}".
-
Can you hold down a button?
-
@Jcjcc, tell me more - what are you trying to accomplish?
-
Can I run this in a background command?
-
@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.
-
@Russ I want to run it before I am logged into the computer.
-
@Daniel-Millan, don't think that's possible.
-
@Russ
Okay, thanks. -
@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.
-
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,
-
@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 -
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.
-
How could I press windows key + "P" so I can open up the projection options?
-
@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
-
@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 keyWith 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