Eljay
Elite Member
:O
Posts: 2949 Reputation: 77
– / / –
Joined: May 2004
|
RE: if (program.open)...
code: function IsProcessRunning(ProcessName){
var WMI = new ActiveXObject('WbemScripting.SWbemLocator');
var WMIInstance = WMI.ConnectServer('.', "root\\cimv2");
var Processes = WMIInstance.ExecQuery("Select * from Win32_Process Where Name = '" + ProcessName + "'");
return ((Processes.Count > 0) ? true : false);
}
//Example usage
var NotepadRunning = IsProcessRunning("notepad.exe");
EDIT: GeSHi phails
This post was edited on 01-31-2007 at 05:55 PM by Eljay.
|
|