如果您需要签入 LISP 特定Windows应用程序或进程(在任务管理器中可以看到的项目)正在运行的应用程序,可以使用以下命令 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)
)
为了 程序名 参数,请使用任何标识特定应用程序或进程的运行字符串的子字符串-例如参数 "学院。可执行程序” 应该总是回来 T,作为 的AutoCAD is running for sure:
(在跑? ”学院。可执行程序”)
Windows索引编制过程正在运行吗?
(是否正在运行?“ SearchProtocolHost”)