Author Topic: Copy by Inno Setup  (Read 357 times)

0 Members and 1 Guest are viewing this topic.

amir0914

  • Mosquito
  • Posts: 8
Copy by Inno Setup
« 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;
« Last Edit: November 07, 2020, 12:17:20 AM by amir0914 »

Peter2

  • Swamp Rat
  • Posts: 609
Re: Copy by Inno Setup
« Reply #1 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
Peter

AutoCAD Map 3D 2018 German (so some technical terms will be badly retranslated to English)
BricsCAD V19

d2010

  • Newt
  • Posts: 95
Re: Copy by Inno Setup
« Reply #2 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...
« Last Edit: November 09, 2020, 04:44:24 AM by d2010 »

amir0914

  • Mosquito
  • Posts: 8
Re: Copy by Inno Setup
« Reply #3 on: November 09, 2020, 06:45:27 AM »
There is no Forum for InnoSetup, only has a google group that is not very active.

amir0914

  • Mosquito
  • Posts: 8
Re: Copy by Inno Setup
« Reply #4 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.
« Last Edit: November 09, 2020, 06:56:14 AM by amir0914 »

VVeli

  • Newt
  • Posts: 22
Re: Copy by Inno Setup
« Reply #5 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
Br. Veli

amir0914

  • Mosquito
  • Posts: 8
Re: Copy by Inno Setup
« Reply #6 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.