Jump to content

[Feature] WMI-based TimedWaitForProgram (no tasklist prompts)

Recommended Posts

Remove from jscript.js:

function TimedWaitForProgram(ImageName,HowLong){  position="jscript.js";whatfunc="TimedWaitForProgram()";var Elapsed=3;Pause(3,0);while (Elapsed<=HowLong*60){  var oExec = WshShell.Exec('tasklist.exe');  while (oExec.Status == 0)   Pause(0,100);  var Output = oExec.StdOut.ReadAll() + oExec.StdErr.ReadAll();  if (Output.search(ImageName)==-1)   return;  Pause(3,0);  Elapsed += 3;}}

At the bottom of WMI.js add:

function TimedWaitForProgram(ImageName,HowLong){  position="wmi.js";whatfunc="TimedWaitForProgram()";try{  objWMIService=GetObject("winmgmts:\\\\" + "." + "\\root\\CIMV2");  var Elapsed=0;  while (!HowLong || (Elapsed<=HowLong*60))  {   colItems=objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name='"+ImageName+"'");    if (colItems.Count > 0)    return true;    Pause(1,0);   Elapsed += 1;  }}catch(ex){}return false;}
Edited by Francesco
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.

  • Create New...