最近我也遇到这个问题,运行下面的程序,启动组也是空的- ;|= 将程序加入启动组
- @== (AddStartup AppName)
- #== return:
- par: AppName: [str] 完整路径
- sample: (AddStartup "e:\\12.lsp")
- ver: [1.0] by xshrimp @mjtd
- [1.1] by lostbalance
- ====================|;
- (defun AddStartup (AppName / $akey $skey loadctrlnum NumStartup acadpath loader)
- (setq acadpath (vl-filename-directory (findfile "acad.exe"))) ;;获取AutoCAD的安装路径
- (if (= (type appname) 'STR)
- (progn
- (setq
- $skey (strcat "HKEY_CURRENT_USER\" (vlax-product-key) "\\Profiles\" (getvar "CPROFILE") "\\Dialogs\\Appload\\Startup")
- $akey (strcat "HKEY_CURRENT_USER\" (vlax-product-key) "\\Applications\\AcadAppload" )
- )
- ;;加入启动组
- (setq NumStartup (vl-registry-read $skey "NumStartup"))
- (if NumStartup
- (progn
- (vl-registry-write $skey "NumStartup" (itoa (+ 1 (atoi NumStartup))))
- (vl-registry-write $skey (strcat (itoa (+ 1 (atoi NumStartup))) "Startup") AppName )
- )
- (progn
- (vl-registry-write $skey "NumStartup" "1")
- (vl-registry-write $skey "1Startup" AppName )
- )
- )
- ;;读取LoadCtrls的值,将这个值与2作“或”运算,再写回。这样可以保证AutoCAD启动时会加载Appload.arx模块。
- ;;不设置LOADCTRLS的话,加入启动组的程序无法正确加载,需要手动启动启动组确认后才可以
- (setq loadctrlnum (vl-registry-read $akey "LOADCTRLS"))
- (if loadctrlnum
- (vl-registry-write $akey "LOADCTRLS" (Boole 7 loadctrlnum 2))
- (vl-registry-write $akey "LOADCTRLS" 15)
- )
- (setq loader (vl-registry-read $akey "LOADER"))
- (if (not loader)
- (progn
- (vl-registry-write $akey "DESCRIPTION" "AcadAppload Command Module") ;;此条可以不加,注释性内容,不影响正常启动
- (vl-registry-write $akey "LOADER" (strcat acadpath "\\Appload.arx")) ;;全新安装或格式化后的AutoCAD默认不加载appload.arx,需添加
- )
- )
- ; T ;;这个T什么用?
- )
- nil
- )
- )
|