jeudi 5 mars 2020

VBS code to relaunch vbs if web browser is closed in Windows 10

This is my first attempt at VB.

I've replaced explorer.exe with this vbs to put it in a sort of "kiosk" mode on boot. I've done this in the registry by replacing winlogon shell explorer.

I have a VB script that launches Chrome, goes to a website and logs in.

I want to make it so if anyone closes Chrome, it starts the script again, so it will go to the website, and log back in.

Please note, I've replaced the web address, logon e-mail, and password for privacy.

https://website.com.au
emailaddress@domain.com.au
password

Current working code below:

set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "Chrome.exe -framemerging https://website.com.au/" 
WScript.Sleep 5000
WshShell.SendKeys "{tab}" 
WshShell.SendKeys "{tab}" 
WshShell.SendKeys "emailaddress@domain.com.au{enter}"
WshShell.SendKeys "{tab}" 
WshShell.SendKeys "Password{enter}"
WScript.Sleep 1000 


WScript.Quit 

I'm thinking something like a check to see if Chrome process is running, if not start from top of script again.

Any help would be greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire