Batch file for Pressing Shortcut Keys

adifadipe

Reputable
Oct 31, 2015
13
0
4,510
I have created a batch file for connecting to making a skype call...below now the below script just makes a audio call, In order to start the video I have to press Shift+Ctrl+R which I want to incorporate in the code itself. I tried below but it doesn't work. Can you advise what's going wrong over here...

"C:\Program Files (x86)\Skype\Phone\skype.exe" /callto:someone

Sleep 10

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "Shift+Ctrl+R"
 
Solution
Try looking at this page here for the key codes: http://ss64.com/vb/sendkeys.html
also, are you implementing that code (the wshshell.sendkeys codes and set wshshell) in a batch file? if so, you require to put it in a vbs script, not a batch file. and if you're getting an error for when you want to get the script to sleep, use timeout 5 >nul instead, but if you're not, you dont need to change that.

So your batch file and vbs script would be something like this:

@echo off
"C:\Program Files (x86)\Skype\Phone\skype.exe" /callto:someone
timeout 5 >nul OR sleep 10 if you'd like

*then you will have to put this code into a vbs script:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "Shift+Ctrl+R"
and then after the...
Try looking at this page here for the key codes: http://ss64.com/vb/sendkeys.html
also, are you implementing that code (the wshshell.sendkeys codes and set wshshell) in a batch file? if so, you require to put it in a vbs script, not a batch file. and if you're getting an error for when you want to get the script to sleep, use timeout 5 >nul instead, but if you're not, you dont need to change that.

So your batch file and vbs script would be something like this:

@echo off
"C:\Program Files (x86)\Skype\Phone\skype.exe" /callto:someone
timeout 5 >nul OR sleep 10 if you'd like

*then you will have to put this code into a vbs script:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "Shift+Ctrl+R"
and then after the timeout command or sleep command, you make a folder, put the batch file in, and put the vbs file in
and put this command after the timeout or sleep command:

start "vbs script"

So it would look like this:

@echo off
"C:\Program Files (x86)\Skype\Phone\skype.exe" /callto:someone
timeout 5 >nul OR sleep 10 if you'd like
start "vbs file name with .vbs at the end"

if the vbs script still doesnt work, look at the page i linked for help with the button codes
 
Solution