请教 用纯lisp怎么操作,输入命令返回到系统桌面?
请教 1、用纯lisp怎么操作,输入命令返回到系统桌面,输入一个命令,系统显示桌面2、用纯lisp怎么操作,输入命令打开某一个盘的某一个文件夹中的文件夹
本帖最后由 1291500406 于 2020-3-19 17:06 编辑
很早以前dos的时代
方法1 start
(command "start" "shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}")(command "start" "c:/")
方法2 shell(command "shell"(strcat "start " "shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}"))(command "shell" "start c:/")
外部软件微软公司提供了两个应用explorerrundll32 ~
方法3 explorer
(startapp "explorer shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}")(startapp "explorer c:/")
方法4 rundll32
(startapp "rundll32 url.dll,FileProtocolHandler shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}")(startapp "rundll32 url.dll,FileProtocolHandler c:/")
ActiveX方法最多 数不清 以下是部分举例
方法5ToggleDesktop
(vlax-invoke(vlax-create-object"{13709620-c279-11ce-a49e-444553540000}")"ToggleDesktop" )
方法6open
(vlax-invoke(vlax-create-object"{13709620-c279-11ce-a49e-444553540000}")"open" "shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}")
(vlax-invoke(vlax-create-object"{13709620-c279-11ce-a49e-444553540000}")"open" "c:\\")
方法7run
(vlax-invoke(vlax-create-object"{72c24dd5-d70a-438b-8a42-98424b88afb8}")"run" "shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}" )
(vlax-invoke(vlax-create-object"{72c24dd5-d70a-438b-8a42-98424b88afb8}")"run" "c:/")
方法8ControlPanelItem
(vlax-invoke(vlax-create-object"{13709620-c279-11ce-a49e-444553540000}")"ControlPanelItem""shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}" )
(vlax-invoke(vlax-create-object"{13709620-c279-11ce-a49e-444553540000}")"ControlPanelItem""c:/" )
方法9 SpecialFolders
(set 'bbActiveX(vlax-create-object"{72c24dd5-d70a-438b-8a42-98424b88afb8}"))
(vlax-invoke bbActiveX "exec"(strcat "explorer.exe "(vla-item(vlax-get bbActiveX "SpecialFolders" ) "desktop")))
(vlax-invoke bbActiveX "exec"(strcat "explorer.exe "(vla-item(vlax-get bbActiveX "SpecialFolders" ) "c:/")))
方法10 ShellExecute
(vlax-invoke(vlax-create-object"{13709620-c279-11ce-a49e-444553540000}")"ShellExecute""rundll32" "url.dll,FileProtocolHandler shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}")
(vlax-invoke(vlax-create-object"{13709620-c279-11ce-a49e-444553540000}")"ShellExecute""rundll32" "url.dll,FileProtocolHandler c:/")
还有很多...
我不知道楼主的这个要求是想快速解决问题,还是有其他的不方便
我的快速达到方式:
1,快捷键win+D键即可立马回到Windows桌面
2,安装Listary Pro软件,添加你经常用的文件夹(设置里),在CAD界面的时候,先win+D回到桌面或者win+E(打开资源管理器),然后打开Listary Pro(我设置的是按鼠标中键弹出菜单),点击你之前设定好的文件夹 (defun c:tt1(/ shell) ;显示桌面
(vl-load-com)
(setq shell (vlax-get-or-create-object "Shell.Application"))
(vlax-invoke-method shell 'ToggleDesktop)
(vlax-release-object shell)
(princ)
)
(defun c:tt2(/ ws);打开D盘
(vl-load-com)
(setq ws (vlax-get-or-create-object "WScript.Shell"))
(vlax-invoke ws "Run" "D:\\")
(vlax-release-object ws)
(princ)
) jh1005 发表于 2020-3-18 14:15
(defun c:tt1(/ shell) ;显示桌面
(vl-load-com)
(setq shell (vlax-get-or-create-object "Shell.A ...
学到了,谢谢,:lol 2楼很好,测试很成功,楼主把3个币快兑现 (startapp "explorer shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}")这个最简单 本帖最后由 urings 于 2020-3-19 23:04 编辑
提供一种方式:
(defun testopen (dir)
(vla-eval (vlax-get-acad-object) (strcat "Shell \"explorer.exe \" & \"" dir "\", vbNormalFocus"))
)
(defun c:tt ()
(testopen "c:\\")
)
LISP获取桌面路径
(defun dirdesktop (/ dir)
(if (and
(setq dir (getenv "userprofile"))
(setq dir (findfile (strcat dir "\\desktop")))
)
dir
)
)
(defun c:tt2 ()
(dirdesktop)
)
有意义的好贴标记一下。
页:
[1]