Over 1.118.000 registered users (EN+CZ).
AutoCAD tips, Inventor tips, Revit tips, Civil tips, Fusion tips.
The new Beam calculator, Spirograph generator and Regression curves in the Converters section.
New AutoCAD 2027 commands and sys.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
11468×
this tip shared by ARKANCE experts applies to: AutoCAD ·
![CAD Forum - ARKANCE Community - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz]](../common/arkance_186.png)

