function IsProcessRunning(/**string|number*/ pidOrName)
{
var strComputer = ".";
var SWBemlocator = new ActiveXObject("WbemScripting.SWbemLocator");
var objCtx = new ActiveXObject("WbemScripting.SWbemNamedValueSet")
objCtx.Add("__ProviderArchitecture", 64);
var objWMIService = SWBemlocator.ConnectServer(strComputer, "/root/CIMV2", "", "", null, null, null, objCtx);
var query = "Select * from Win32_Process";
if(typeof(pidOrName) == "number")
{
query += " WHERE Handle=" + pidOrName;
}
else if (typeof(pidOrName) == "string")
{
query += " WHERE Name='" + pidOrName + "'";
}
var colItems = objWMIService.ExecQuery(query);
var e = new Enumerator(colItems);
for(; ! e.atEnd(); e.moveNext())
{
Log(e.item().Handle + ":" + e.item().Name);
if (pidOrName) return true;
}
if (pidOrName) return false;
}
Global.DoLaunch('iexplore.exe');
Log("PID: "+Global.lastPid+" Running: "+IsProcessRunning(Global.lastPid));