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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Script: Launch Application When Idle 1

Status
Not open for further replies.

Pleonasm

Technical User
May 20, 2004
121
CA
I am soliciting the assistance of a forum member in finding or creating a VB script that launches an application if (1) a specified process is not already running and (2) the PC is ‘idle’ (i.e., CPU usage is below a specified threshold). The script would loop until either the CPU usage condition is met or a maximum duration has been exceeded.

A conceptual outline of the script logic would roughly be as follows.

BEGIN
LET APP=”C:\Program Files\Application.exe”
LET PROCESS=”ProcessX.exe”
LET CPU_USAGE=50 {% of time the processor is running}
LET PAUSE_TIME=5 {seconds}
LET MAX_TIME=120 {seconds}
IF (‘PROCESS’ is already running) THEN
EXIT
ELSE
DO
IF (CPU usage <= ‘CPU_USAGE’) THEN
IF (‘PROCESS’ is already running) THEN
EXIT
ELSE
Launch ‘APP’
EXIT
ELSE
Pause for ‘PAUSE_TIME’
WHILE (total run time of script <= ‘MAX_TIME’)
EXIT
END

All recommendations and assistance are greatly appreciated!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top