The process ID (PID) for a process started with the WshScriptExec object.
Parameters
- Object
-
WshScriptExec object.
Remarks
Example
The following code uses the ProcessID property to activate the calculator and notepad applications.
JScript | Copy Code |
---|
function delayedSendKeys(str)
{
WScript.Sleep(100);
WshShell.SendKeys(str);
}
var WshShell = new ActiveXObject("WScript.Shell");
var oCalc = WshShell.Exec("calc");
var oNotepad = WshShell.Exec("notepad");
WScript.Sleep(500);
WshShell.AppActivate(oCalc.ProcessID);
delayedSendKeys("1{+}1~");
delayedSendKeys("^C");
delayedSendKeys("%{F4}");
WshShell.AppActivate(oNotepad.ProcessID);
delayedSendKeys("1 {+} 1 = ^V"); |
See Also