Help needed with VBScript closing a process when its idle
I'm looking at trying to get a vbscript that checks if a specific application is idle and if so kills the process.
I've currently got a script to open the application and run an interface, however once the interface job is complete I need it to close the app.
I can't use wScript.Sleep as it depends on how much data is being processed before its to be closed, so ideally what I need is it to check if it's using 00 CPU in Task Manager and if so kill it, if not keep looping until it is.
So for an example:
I have notepad.exe open. The script checks to see if its idle. If it's using 01 CPU or more then to loop and check again until its at 00.
Once it gets to 00 CPU, kill notepad.exe
I'm quite new to using vbscripts so any help would be greatly appreciated.