Hello,
I am using a shell function to open up a program and then use SendKeys to open up tabs in the menu bar by shortcut keys(ie:ALT-P then ALT-L). The problem I am having is that the script keeps running but does not preform the ALT-P and ALT-L function because the program does not come up into FOCUS. It seems if I put the form into Focus by a single click of the window the rest of the code executes fine. Is there a way to 1. Get the program to come up in Focus or 2. Just preform the hot key functions without focus. The focus would be a big help but it is fine without. Thanks in advanced. My code is below:
I am using a shell function to open up a program and then use SendKeys to open up tabs in the menu bar by shortcut keys(ie:ALT-P then ALT-L). The problem I am having is that the script keeps running but does not preform the ALT-P and ALT-L function because the program does not come up into FOCUS. It seems if I put the form into Focus by a single click of the window the rest of the code executes fine. Is there a way to 1. Get the program to come up in Focus or 2. Just preform the hot key functions without focus. The focus would be a big help but it is fine without. Thanks in advanced. My code is below:
Code:
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run """C:\Program Files\Program Name.exe"""
Wscript.Sleep 6000
WshShell.SendKeys "Username"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "Password"
WshShell.SendKeys "{TAB 3}"
WshShell.SendKeys "{ENTER}"
Wscript.Sleep 40000
WshShell.AppActivate ""
WshShell.SendKeys "%{p} {l}"
Wscript.Sleep 5000
WshShell.SendKeys "{TAB 3}"
WshShell.SendKeys "M"
Wscript.Sleep 5000
WshShell.SendKeys "+{TAB}"
WshShell.SendKeys "+{TAB}"
WshShell.SendKeys "+{TAB}"
WshShell.SendKeys "Text Imput"