VB script to open a program
I've created 2 batch files to start 2 applications on boot (maybe I could have done it with 1 batch file but I didn't know how to, and I don't even know if it would have made any difference anyways?)
Batch file #1 to start the 1st application (if the application crashes, I want it to restart)
:start start.bat goto start
Batch file #2 to start VB script which is supposed start 2nd application and apply profile settings
:loop ab-autostart.vbs timeout /t 3600 goto loop
(VB script is set intentionally to loop, and apply those same profile settings every 60 minutes, because it sometimes, for some reason, resets to default settings)
And, finally, the VB scripts which starts 2nd application, and applies profile settings
Set WshShell = CreateObject("WScript.Shell") WshShell.SendKeys "%^1" WScript.Sleep(5000) WshShell.SendKeys "+2" WScript.Quit
(5 seconds delay is to allow application to fully load before keys for profile settings are sent).
Everything goes well up to the point where VB script is supposed to send the keys to apply profile settings (WshShell.SendKeys "+2"). Basically, the settings never get applied.
I am guessing I somehow need to instruct VB script which window it should send the keys to, because 3 windows are open at the same time (1st application, VB script, and 2nd application)? Or, maybe I need to start the 1st application and VB script minimized, so I would be left only with one window, which is the 2nd application where profile settings should be applied (if so, how?). Or, maybe, there is some other solution and I am doing this all wrong :)
Any help would be greatly appreciated!