TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: civil.eng on November 07, 2020, 12:11:39 AM

Title: Copy by Inno Setup
Post by: civil.eng on November 07, 2020, 12:11:39 AM
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?


Code: [Select]
[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;
Title: Re: Copy by Inno Setup
Post by: Peter2 on November 09, 2020, 03:57:30 AM
Did you ask in Innosetup Forum? I suppose there you will find more specialists for "Loop" and so on
Title: Re: Copy by Inno Setup
Post by: d2010 on November 09, 2020, 04:38:51 AM
You need AdministratorRights inside Windows10.Perhaps ,even you execute "Setup.exe As Admin", perhaps the Win10 reject your copy. :tongue2:
Hi all,
should be a loop to do that correctly, Can someone help me with this issue?
You see here when, I need copy-sourceFolder (e.g. Libc\*.* with all-subfolders) then I use Libc\*.* and I add "CopyMode: alwaysoverwrite; Flags: recursesubdirs" at the finished. :whistling:
Code: [Select]
Source: "c:\vlaxcompil\help\*.*";          DestDir: "{sd}\vlaxcompil\help";     CopyMode: alwaysoverwrite; Flags: recursesubdirs
Source: "c:\vlaxcompil\libc\*.*";          DestDir: "{sd}\vlaxcompil\libc";      CopyMode: alwaysoverwrite; Flags: recursesubdirs
Source: "c:\vlaxcompil\qnetacad\*.*";      DestDir: "{sd}\vlaxcompil\qnetacad"; CopyMode: alwaysoverwrite; Flags: recursesubdirs

Thank you...
Title: Re: Copy by Inno Setup
Post by: civil.eng on November 09, 2020, 06:45:27 AM
There is no Forum for InnoSetup, only has a google group that is not very active.
Title: Re: Copy by Inno Setup
Post by: civil.eng on November 09, 2020, 06:52:24 AM
You need AdministratorRights inside Windows10.Perhaps ,even you execute "Setup.exe As Admin", perhaps the Win10 reject your copy. :tongue2:
Hi all,
should be a loop to do that correctly, Can someone help me with this issue?
You see here when, I need copy-sourceFolder (e.g. Libc\*.* with all-subfolders) then I use Libc\*.* and I add "CopyMode: alwaysoverwrite; Flags: recursesubdirs" at the finished. :whistling:
Code: [Select]
Source: "c:\vlaxcompil\help\*.*";          DestDir: "{sd}\vlaxcompil\help";     CopyMode: alwaysoverwrite; Flags: recursesubdirs
Source: "c:\vlaxcompil\libc\*.*";          DestDir: "{sd}\vlaxcompil\libc";      CopyMode: alwaysoverwrite; Flags: recursesubdirs
Source: "c:\vlaxcompil\qnetacad\*.*";      DestDir: "{sd}\vlaxcompil\qnetacad"; CopyMode: alwaysoverwrite; Flags: recursesubdirs

Thank you...

What you have done in the above is the opposite of my purpose, it means you copy all files of a folder to a destination and I did it before, but now I want to copy single file to multiple directory. also it's not up to run administrator.
Title: Re: Copy by Inno Setup
Post by: VVeli on November 18, 2020, 07:24:40 AM
Hi,
you need to get all folders from installed AutoCAD folder.
That function RegGetSubkeyNames(RootKey, AcadRegKey, AcadVerNames) gives you an list of all installed AutoCAD´s on your computer.
Maybe you can modify this code: https://stackoverflow.com/questions/33391915/inno-setup-copy-folder-subfolders-and-files-recursively-in-code-section (https://stackoverflow.com/questions/33391915/inno-setup-copy-folder-subfolders-and-files-recursively-in-code-section)
Br. Veli
Title: Re: Copy by Inno Setup
Post by: civil.eng on November 20, 2020, 08:35:50 AM
Hi, Thanks VVeli,
We have all folders of installed Autocad on system in AcadExes or sAcadExeLocation.,I also used FileCopy method in loop, but it's not working. can you take a look at my codes? or add copy method to all autocad folders in your function on this post : http://www.theswamp.org/index.php?topic=45075.30
Thanks in advance.
Title: Re: Copy by Inno Setup
Post by: d2010 on April 03, 2021, 04:12:36 PM
Please help me,
Q1=How to Add - AgreementForm inside InnoSetp.iss?