I 've created an application with Visual Basic, containing a menu bar. Using a menu bar in the application, I can start VB scripts, which works fine.
The next step is to schedule the tasks daily, so I don't have to manually start the scripts.
I would like to use the Task Scheduler to perform the tasks daily and wrote an .vbs script which I scheduled in the Task Scheduler. Testing the script by manually starting the task from Task Scheduler works. But when scheduled (eg for the next morning) it fails: the program is started, but the next step is not performed.. I'am using a laptop, powered at all times, sleeping mode is off, Windows10
My vbs script:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys("{F13}")
WScript.Sleep 10*1000 '10 sec
WshShell.Run "C:\360_Stuurprogramma\bin\Debug\360_Stuurprogramma.exe"
WScript.Sleep 5*1000 '5 sec
WshShell.AppActivate """360 Applicatie"" -p1 -c"
WScript.Sleep 20*1000
wshShell.SendKeys "^S"
WScript.Sleep 20*60*1000 '20 min, maximum time needed to perform the job
WshShell.Run "taskkill /f /im 360_Stuurprogramma.exe", , True