- 积分
- 6483
- 明经币
- 个
- 注册时间
- 2002-4-17
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
楼主 |
发表于 2005-4-21 20:39:00
|
显示全部楼层
spshchen发表于2005-4-21 9:49:00秋枫兄,你能提供脚本吗?或者提供如何把选中的文件作为启动文件吗? 就是遍历注册表:- procedure AddAutoLoadLisp;
- var i, j, k, n: integer;
- StartupToAdd, key, tmp: string;
- profiles: TArrayOfString;
- StringList: TStringList;
- ApploadLoadCtrls: Cardinal;
- begin
- StartupToAdd := ExpandConstant('{app}\{ini:{src}\setup.ini,General,LISPStartup|}'); // 设置appload的loadctrls
- for i := 0 to GetArrayLength(SupportedAcadKeys) -1 do
- begin
- if RegQueryDWordValue(HKLM, SupportedAcadKeys[i]+'\Applications\AcadAppload', 'LOADCTRLS', ApploadLoadCtrls) then
- begin
- ApploadLoadCtrls := (ApploadLoadCtrls or 2);
- RegWriteDWordValue(HKLM, SupportedAcadKeys[i]+'\Applications\AcadAppload', 'LOADCTRLS', ApploadLoadCtrls);
- end;
- if RegQueryDWordValue(HKCU, SupportedAcadKeys[i]+'\Applications\AcadAppload', 'LOADCTRLS', ApploadLoadCtrls) then
- begin
- ApploadLoadCtrls := (ApploadLoadCtrls or 2);
- RegWriteDWordValue(HKCU, SupportedAcadKeys[i]+'\Applications\AcadAppload', 'LOADCTRLS', ApploadLoadCtrls);
- end;
- end; StringList := TStringList.Create;
- try
- for i := 0 to GetArrayLength(SupportedAcadKeys) -1 do
- if AutoCADSelectPage.Values[i] // 用户选中要求安装的
- and RegGetSubkeyNames(HKCU, SupportedAcadKeys[i]+'\profiles', profiles) // 并且存在Profiles, 取得所有Profiles
- then
- for j := 0 to GetArrayLength(profiles)-1 do
- if regkeyExists(HKCU, SupportedAcadKeys[i]+'\Profiles\'+profiles[j]+'\Dialogs') then
- begin
- key := SupportedAcadKeys[i]+'\Profiles\'+profiles[j]+'\Dialogs\Appload\Startup';
- if not regkeyExists(HKCU, key) then RegWriteStringValue(HKCU, key, 'NumStartup', '0');
- RegQueryStringValue(HKCU, key, 'NumStartup', tmp);
- // 读入已有Startup列表
- n := StrToIntDef(tmp, 0);
- StringList.Clear;
- for k := 1 to n do
- begin
- RegQueryStringValue(HKCU, key, IntToStr(k)+'Startup', tmp);
- StringList.Add(tmp);
- RegDeleteValue(HKCU, key, IntToStr(k)+'Startup');
- end;
- // 去除重复文件与不存在的文件
- for k := StringList.Count - 1 downto 0 do
- if (UpperCase(StringList[k])=UpperCase(startupToAdd)) or (not FileExists(StringList[k]))
- then StringList.Delete(k);
- // 添加要加的文件
- StringList.Add(startupToAdd);
- // 重建键值
- for k := 0 to StringList.Count - 1 do
- RegWriteStringValue(HKCU, key, IntToStr(k+1)+'Startup', StringList[k]);
- // 设置总数
- RegWriteStringValue(HKCU, key, 'NumStartup', IntToStr(StringList.Count));
- end;
- finally
- StringList.Free;
- end;
- end;
|
|