wyl219 发表于 2019-10-23 18:18:18

shuaier 发表于 2019-10-23 11:33
*.ARX能加载不?

load函数好像不支持arx文件吧?

qmqyqj 发表于 2019-10-28 10:53:17

wyl219 发表于 2019-10-23 18:11
(defun wyl:autoloadlsp( / lst_fnm lst_dir i )
        (setq lst_dir (list "D:/_同步文件/CAD程序/lsp/lisp/ ...

可以先向注册表写入当前文件的路径,然后读取注册表使用

wyl219 发表于 2019-10-28 11:52:08

qmqyqj 发表于 2019-10-28 10:53
可以先向注册表写入当前文件的路径,然后读取注册表使用

那怎么自动获取当前的路径呢?

qmqyqj 发表于 2019-10-28 14:12:30

wyl219 发表于 2019-10-28 11:52
那怎么自动获取当前的路径呢?

;运行路径设置常数
(setq envstr(getenv "processor_architecture"))
   (if(vl-string-search "64" envstr)
      (setq X64 T)
      (setq X64 nil)
)
(vl-load-com)
(vl-catch-all-apply
'(lambda ( / nn str html)
(while (= (logand (getvar "CmdActive") 1) 1) (command))
(princ "\n")
(command "_.copyhist")
(and (setq html (vlax-create-object "htmlfile"))
       (setq str (vlax-invoke-method (vlax-get (vlax-get html 'parentwindow) 'clipboarddata) 'getdata "text")
             str (strcase (if (= (type str) 'variant) (vlax-variant-value str) str))
       )
       (progn
              (if (getvar "secureload") (setvar "secureload" 0))
          (setq str (vl-string-right-trim "\"\) " str))
          (while (setq nn (vl-string-position 34 str)) ;(ascii "\"") = 34
                (setq str (substr str (+ nn 2)))
          )
          (while (vl-string-search "\r\n" str)
               (setq str (vl-string-subst "" "\r\n" str))
          )
          (setq str (vl-filename-directory (vl-string-translate "/" "\\"str)))
       )
       (progn
          (setq cadver(substr (getvar"ACADVER") 1 4))
(setq rjlj (strcat str ))
      )
)
(and html (vlax-release-object html))
(princ)
)
nil
)
(setq rjlj1 (strcat rjlj "\\"));路径后面加 \
(vl-registry-write "HKEY_CURRENT_USER\\Software\\yousheyun\\CAD""Path"rjlj1 );路径写入注册表
(setq YSYlujin
(vl-registry-read "HKEY_CURRENT_USER\\Software\\yousheyun\\CAD""Path"));读取注册表路径并设置为路径变量


xiaojiajun160 发表于 2021-10-30 21:21:16

感觉好难啊!
页: 1 [2]
查看完整版本: 自动加载文件目录下的lsp、vlx和fas文件