Hi all,
I need to copy a Font to all installed directory of Autocad on a system, I found a piece of code to find All autocad directory and it works correct, but the method in [Files] copy the Font only to one directory and not all, I guess the method in [Files] should be a loop to do that correctly, Can someone help me with this issue?
[Files]
Source: "Fonts\kite.shx"; DestDir: {code:GetInstalledAutoCADVersions};
[Code]
var
AcadVerNames, AcadVerKeys, AcadExes: TArrayOfString;
function GetInstalledAutoCADVersions(Dummy: string): string;
var
S, V, AcadRegKey, sAcadExeLocation: String;
//AcadVerNames, AcadVerKeys, AcadExes: TArrayOfString;
RootKey, I, J: Integer;
begin
if IsWin64 then
begin
RootKey := HKLM64;
end
else
begin
RootKey := HKEY_LOCAL_MACHINE;
end;
AcadRegKey := 'SOFTWARE\Autodesk\AutoCAD';
if RegGetSubkeyNames(RootKey, AcadRegKey, AcadVerNames) then
begin
S := '';
for I := 0 to GetArrayLength(AcadVerNames)-1 do
begin
//MsgBox(AcadRegKey + ” + AcadVerNames[I], mbInformation, MB_OK);
//if RegGetSubkeyNames(RootKey, AcadRegKey + ” + AcadVerNames[I], AcadVerKeys) then
if RegGetSubkeyNames(RootKey, AcadRegKey + '\' + AcadVerNames[I], AcadVerKeys) then
begin
for J := 0 to GetArrayLength(AcadVerKeys)-1 do
begin
//MsgBox(AcadRegKey + ” + AcadVerNames[I] + ” + AcadVerKeys[J], mbInformation, MB_OK);
if RegQueryStringValue(RootKey, AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeys[J], 'Location', sAcadExeLocation) then
begin
SetArrayLength(AcadExes, I+1);
AcadExes[I] := sAcadExeLocation;
Result := AcadExes[I];
end;
end;
end;
end;
end;
end;