Over 1.095.000 registered users (EN+CZ).
AutoCAD tips, Inventor tips, Revit tips.
Try the new precise Engineering calculator.
New AutoCAD 2026 commands and variables.
CAD tip # 12306:
Question
A
If you need to check in your LISP application whether a specific Windows application or process (items you can see in the Task Manager) is running, you can use the following LISP function:
(defun isRunning? (procname / apps item lst meth1 meth2 WMI) (setq WMI (vlax-create-object "WbemScripting.SWbemLocator") meth1 (vlax-invoke WMI 'ConnectServer nil nil nil nil nil nil nil nil) meth2 (vlax-invoke meth1 'ExecQuery "Select * from Win32_Process")) (vlax-for item meth2 (setq lst (append lst (list (vlax-get item 'CommandLine)))) ) (vlax-release-object WMI) (vlax-release-object meth1) (vlax-release-object meth2) (setq lst (vl-remove nil lst)) (vl-some '(lambda (s) (wcmatch (strcase s) (strcat "*" (strcase procname) "*"))) lst) )
For the procname parameter, use any substring identifying the runstring of the specific application or process - e.g. the parameter "acad.exe" should always return T, as AutoCAD is running for sure:
(isRunning? "acad.exe")
Is the Windows indexing process running?
(isRunning? "SearchProtocolHost")
ACAD


8.7.2019
10578×

applies to: AutoCAD ·