Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript Help

Status
Not open for further replies.

minofso

Technical User
Feb 8, 2014
4
GB
I am trying to create a script that can open a program, pause for 1 minute and then close the program.
I have successfully been able to open the program and pause but cannot get the script to close the program.
Here is my script.....

Set ObjShell = CreateObject("WScript.Shell")
ObjShell.Exec ("C:\Program Files\Norton Internet Security\Engine\21.1.0.18\uistub.exe")
WScript.sleep 60000
ObjShell.SendKeys "%{F4}"

The program window just stays open but if I manually key in Alt+F4 on the keyboard, then the window closes.
I have tried this script to open notepad.exe, pause and then close and it works ok.

Any help would be much appreciated

Thanks
 
Set ObjShell = CreateObject("WScript.Shell")
Set wshexec = ObjShell.Exec("C:\Program Files\Norton Internet Security\Engine\21.1.0.18\uistub.exe")
WScript.sleep 60000
wshexec.Terminate
 
Thank you for your reply.
I have inserted the line you gave but now get this error

Windows Script Host
Line: 5
Char: 1
Error:Oject required 'wsexec'
Code:800A01A8
Source:Microsoft VBScript runtime error.
 
Hi, yes sorry, I didn't alter line 2 correctly.
The program opens ok but still doesn't close after 1 minute
 
In which case uistub.exe is a proxie, launching another process. Neither your code nor my code know anything about that new process, and thus will not close it (and a quick perusal of the Norton sites says that, as the name - uistub - hints, it launches the Norton GUI).
 
I have noticed that when the gui opens, no new process has stated in task manager making me think that the gui is running from the NIS.exe which is constantly running and shouldn't be terminated as this will terminate the anti-virus and firewall.
I am wondering why the send.keys command does not work with the gui when the gui is on top of all other windows but the keyboard keys do.

Many thanks for your time and help in trying to resolve this matter, much appreciated.
 
One has to wonder whether Norton, being a security application, ignores spoofed keyboard input (which is essentially what SendKeys is ...)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top