我需要获取autocad的路径,因为我必须编辑其中的文本(acad.lsp)。现在我必须为每个autocad制作n个版本:
'C:\Program Files\AutoCAD 2009\Support\acad.lsp'
'C:\Program Files\Autodesk\AutoCAD 2015\Support\acad.lsp'
'C:\Program Files\Autodesk\AutoCAD 2016\Support\acad.lsp'
等等。
任何想法? 谢谢 丹尼斯
答案 0 :(得分:1)
您需要阅读注册表(HKEY_LOCAL_MACHINE \ SOFTWARE \ Autodesk \ AutoCAD \ Rxx.x \ ACAD-XXXX:XXX \ AcadLocation):
[..]
var
Releases: TArrayOfString;
I: Integer;
Release: String;
SubVersions: TArrayOfString;
SubVersionsIndex: Integer;
SubVersion: String;
begin
if RegGetSubkeyNames(HKEY_LOCAL_MACHINE, 'SOFTWARE\Autodesk\AutoCAD\', Releases) then
begin
for I := 0 to GetArrayLength(Releases) - 1 do
begin
Release := Releases[I];
if RegGetSubkeyNames(HKEY_LOCAL_MACHINE, 'SOFTWARE\Autodesk\AutoCAD\' + Release + '\', SubVersions) then
begin
for SubVersionsIndex := 0 to GetArrayLength(SubVersions) - 1 do
begin
SubVersion := SubVersions[SubVersionsIndex];
if RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SOFTWARE\Autodesk\AutoCAD\' + Release + '\' + SubVersion, 'AcadLocation', AcadLocation) then
begin
[..]