Gets process identifier of a running application.
AppProcID (program-name [, flags [, retries]])
(s) program-name: name of a Windows EXE or DLL file.
(i) flags: [optional] one of the following values may be specified:
Value |
Meaning |
1 |
check for the named process running in the context of the current session only |
0 |
check for the named process running on the entire system (default) |
(i) retries: (optional) number of retries. Default is 7 retries (with a half-second delay between tries) before returning, if the specified application doesn't exist. You can override this by specifying different value for "retries", which may be >= 0 (0 = no retries).
(l) tab-delimited list of one or more process ids. List contains one process id for each running instance of the named process. An empty string if program-name is not running.
Use this function to obtain the process id of a specific, currently running Windows application. The process id can used with AppExist without knowing a title of an application's main window.
The process id can also be used with WinItemProcID to obtain additional information about a process's windows.
"Program-name" is the name of a Windows EXE or DLL file. The name may include the file extension (and, optionally, a full path to the file).
This function also accepts module name.. The module name is usually the same as the root name of the program, without the extension.
Like AppExist and AppWaitClose, any file extension or path information which is part of the 'program-name' parameter is ignored.
Note: Like AppExist and AppWaitClose this function is not able to detect the existence of 16-bit DOS or Windows applications. Vista/2008 and newer: This function may require an Administrator level account, because it relies on performance monitoring.
; Make sure at least one instance is running. Run('notepad.exe','') ProcIds = AppProcID('notepad') ; Get the first process id. ProcId = ItemExtract(1, ProcIds, @tab) ; Get the window-id of instance 1. WinId = WinItemProcId(ProcId, 0, 0) ; Close the first instance of Notepad.exe in ; the list gracefully. WinClose(WinId) Exit
AppWaitClose, TerminateApp, RunWait, RunShell, WinClose, WinExeName, WinExist, AppExist, WinItemProcID