我是用秋枫版主的样列来修改的(只是替换了名称),我把代码贴上来,请教版主如何添加搜索路径,怎么改,添加在哪里,谢谢! 比如我要添加:D:\SCEI\TQ D:\SCEI\FM ;; 首先定义初始化函数 (defun InitsceiApplication (/ ;; 内部函数 GetMyApplicationPath GetsceiPath strParse StrUnParse scei_AddSupportPath Load_sceiMenu scei_placemenu ;; 局部变量 scei_cmdecho_save ) ;;; 取得本程序的路径. ;;; 文件路径从注册表中读取,这些信息由安装程序负责写入注册表 ;;; --------------------------------------------------------------------------------- (defun GetMyApplicationPath (AppID) (vl-registry-read (strcat "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" AppID "_is1" ) "Inno Setup: App Path" ) ) ;; 这里取得安装后,安装的文件夹的绝对路径 ;; 注意:这里的AppID为"scei", 稍后的安装程序制作向导设置中必须与这里保持一致 (defun GetsceiPath () (GetMyApplicationPath "scei") ) ;;; 解析字符串为表(函数来自明经通道转载) ;;; --------------------------------------------------------------------------------- (defun strParse (Str Delimiter / SearchStr StringLen return n char) (setq SearchStr Str) (setq StringLen (strlen SearchStr)) (setq return '()) (while (> StringLen 0) (setq n 1) (setq char (substr SearchStr 1 1)) (while (and (/= char Delimiter) (/= char "")) (setq n (1+ n)) (setq char (substr SearchStr n 1)) ) ;_ end of while (setq return (cons (substr SearchStr 1 (1- n)) return)) (setq SearchStr (substr SearchStr (1+ n) StringLen)) (setq StringLen (strlen SearchStr)) ) ;_ end of while (reverse return) ) ;_ end of defun ;;; 反解析表为字符串(函数来自明经通道转载) ;;; --------------------------------------------------------------------------------- (defun StrUnParse (Lst Delimiter / return) (setq return "") (foreach str Lst (setq return (strcat return Delimiter str)) ) ;_ end of foreach (substr return 2) ) ;_ end of defun ;;; 添加支持文件搜索路径 ;;; --------------------------------------------------------------------------------- ;;; note: 第二个参数如果为真, 插最前,否则插最后 ;;; (defun scei_AddSupportPath (PathToAdd isFirst / supportlist) (if (not (vl-string-search (strcase (strcat pathToAdd ";")) (strcase (strcat (getenv "ACAD") ";")) ) ) ; 保证不重复添加 (progn (setq supportlist (strparse (getenv "ACAD") ";")) (setq supportlist (vl-remove-if-not 'vl-file-directory-p supportlist ) ) ; 移除不存在的文件夹 (if isFirst (setq supportlist (cons PathToAdd supportlist)) (setq supportlist (append supportlist (list PathToAdd))) ) (setenv "ACAD" (strUnParse supportlist ";")) ) ) ) ;; 根据不同的AutoCAD版本加载不同的菜单文件。 (defun Load_sceiMenu (/ acadver) (setq acadver (atof (getvar "acadver"))) (cond ((and (>= acadver 15.0) (< acadver 16.0)) (command "_menuload" "scei.mns") ) ((and (>= acadver 16.0) (<= acadver 16.1)) (command "_menuload" "all.mns") ) ((>= acadver 16.2) (command "_menuload" "scei2006.mns")) ) ) ;; 这个函数用来插入菜单条 ;; The following code "placemenu" from LUCAS(龙龙仔) (defun scei_placemenu (/ n) (if (menugroup "scei") (progn (setq n 1) (while (< n 24) (if (menucmd (strcat "P" (itoa n) ".1=?")) (setq n (+ n 1)) (progn (if (> n 3) (setq n (- n 2)) (setq n 3) ) ;if ;; 如需插入多条菜单,以反序在这里写: ;; 因只有一条下拉菜单,因此这里4,3,2条注释掉 ;; (menucmd (strcat "p" (itoa n) "=+scei.pop4")) ;; (menucmd (strcat "p" (itoa n) "=+scei.pop3")) ;; (menucmd (strcat "p" (itoa n) "=+scei.pop2")) (menucmd (strcat "p" (itoa n) "=+scei.pop1")) (setq n 25) ) ;progn ) ;if ) ;while ) ;progn ) ;if (princ) ) ;;; 初始化主函数 ;;; --------------------------------------------------- (defun Init_scei () ;; 添加支持路径 (AddSupportPath (GetsceiPath) nil) (AddSupportPath (strcat (GetsceiPath) "\\tq") nil)
;; 如果菜单组还没有被加载,则加载之 (if (not (menugroup "scei")) (Load_sceiMenu) )
;; 安排菜单条的位置 (scei_PlaceMenu) (princ) ) ;;; ----------------------------------------------------- ;;; main: ;;; ----------------------------------------------------- (setq scei_cmdecho_save (getvar "cmdecho")) (setvar "cmdecho" 0) ;; 加载下拉菜单 (scei_AddSupportPath (GetsceiPath) nil) ;; 如果菜单组还没有被加载,则加载之 (if (not (menugroup "scei")) (Load_sceiMenu) ) ;; 插到合适的位置 (scei_placemenu) (setvar "cmdecho" scei_cmdecho_save) (setq scei_cmdecho_save nil) (princ) ) ;_end of defun initsceiApplication (initsceiApplication) ;; 加载主程序 ;; 为节省内存,这里也可以以autoload函数形式定义 ;; 有几条写几条 (load "scei.lsp") (arxload "scei.arx") (command "vbaload" "ACAD.dvb") (princ)
;;================================== 另外,每次加载的菜单都是在这个位置,如图所示,怎么把它修改后,放在“帮助”一栏的后面? 我加载了一个DVB文件,但是每次启动CAD都跳出如下提示,如何能让它不要显示,改如何修改? |