What do you want to install? ...Actually one VLX, compiled from Lisp.
...If you have your own application you can install it in the plugin directory. ....Where? What? How?
...In your package xml you can do the stuff for the different versions. This will only work from 2012 versions I guess. .....Right. But I have to consider it also for (at least) 2011.
.......and wrote my own registry tool (exe) which can be start by IS. In that tool I do a search for the installed versions and create new registry keys.....I hoped to avoid this.
"HKCU\Software\Autodesk\AutoCAD\R19.1\ACAD-D001:407\Applications\MyAPP"
where all red entries can be different.
...The red entries can be determined using the vlax-product-key function.Inside the installation with Innosetup?
... to simply iterate every supported version of AutoCAD and automatically install your autoload key in every flavor and language of those supported versions. ...Do you have an example for this iteration in Pascal / Innosetup?
Do you have an example for this iteration in Pascal / Innosetup?
"HKCU\Software\Autodesk\AutoCAD\R19.1\ACAD-D001:407\Applications\MyAPP"
where all red entries can be different.
The red entries can be determined using the vlax-product-key function.
Stupid question time: is this installation set-up intended for internal distribution (ie. known application targets) or external distribution (ie. sharing with the world)?No, no - stupid questions are my speciality :-D
...Just note, the free version of AcadInst forces you to use their built-in dialogs, it's like an add-ware app. If you pay for it you can get rid of these.Hi irneb
Thanks for the info BB, I need to get with the times :-)
Hi irnebSorry, that's something I used very long ago. Didn't realize it was suspended :oops:. So ignore my previous post.
which version of AcadInstall are you talking about? Byron has suspended his development (I have some products of Cadwerx), and the version which can be found in the web is rather old. And I don't know a current version to purchase. And the Afra-Lisp site talks of version 2004.
Peter
... to simply iterate every supported version of AutoCAD and automatically install your autoload key in every flavor and language of those supported versions. ...Do you have an example for this iteration in Pascal / Innosetup?
procedure AddACADRegKey (Release: String); {eg 'R19.0 for ACAD 2013'}
var
RunTimeNum: String; {eg '19'}
AllProductID: TArrayOfString;
ProductID: String; {eg 'ACAD-9001:409'}
KeyPathShort: String;{eg 'SOFTWARE\Autodesk\AutoCAD\'}
KeyPathLong: String; {eg 'SOFTWARE\Autodesk\AutoCAD\R18.1\ACAD-9001:409\Applications\MyCADApp'}
KeyStringShort: String; {eg c:\Program Files\MyCADApp\LspLoad.'}
KeyStringLong: String; {eg 'c:\Program Files\MyCADApp\LspLoad.19.x64.arx'}
I: Integer;
begin
RunTimeNum := Copy (Release, 2, 2);
KeyStringShort := ExpandConstant('{pf}\MyCADApp\LspLoad.');
KeyPathShort := 'SOFTWARE\Autodesk\AutoCAD\';
if RegGetSubkeyNames(HKLM64, KeyPathShort + Release, AllProductID)
then begin
for I := 1 to GetArrayLength(AllProductID) do begin
ProductID := AllProductID[I-1];
KeyPathLong := KeyPathShort + Release + '\' + ProductID + '\Applications\MyCADApp';
KeyStringLong := KeyStringShort + RunTimeNum + '.x64.arx';
RegWriteDWordValue (HKLM64, KeyPathLong,'LOADCTRLS', 2);
RegWriteStringValue (HKLM64, KeyPathLong,'LOADER',KeyStringLong);
end;
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssPostInstall
then begin
AddAcadRegKey ('R18.2');{ACAD 2012}
AddAcadRegKey ('R19.0');{ACAD 2013}
end;
end;
// define what should be supported
myversions := array ("18.0" "18. 1" "18.2" "19.0")
mylanguages := array ("401" "407" "410" "804")
myproducts := array ("9000" "9001" "A000" "A001" "A007")
// combine all arrays and test what exists in registry
foreach value "myversions"
do all entries
foreach value "mylanguages"
do all entries
foreach value "myproducts"
do all entries
KeyToCheck := HKLM + versionValue + languageValue + productValue
Ifexist KeyToCeck
then
write something to registry
I think this would handle all supported (= defined) software which exists.@BlackBox:
Autoloader is fine, but I have to serve also version beneath 2012 - so Autoloader can not serve these old versions.
The problem is multiplied with languages and versions. So maybe this pseudo-code would help (pseudo-code because my Pascal-knowledge is too low for real code).First, there are many ways of going about this.
[Registry]
Root: HKLM; Subkey: "SOFTWARE\Autodesk\AutoCAD\18.0\ACAD-A000:401\Applications\MyCADApp\"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"; Flags: uninsdeletekey; Check: RegKeyExists(HKLM, 'SOFTWARE\Autodesk\AutoCAD\18.0\ACAD-A000:401')
Root: HKLM; Subkey: "SOFTWARE\Autodesk\AutoCAD\18.1\ACAD-9000:407\Applications\MyCADApp\"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"; Flags: uninsdeletekey; Check: RegKeyExists(HKLM, 'SOFTWARE\Autodesk\AutoCAD\18.1\ACAD-9000:407')
Root: HKLM; Subkey: "SOFTWARE\Autodesk\AutoCAD\19.0\ACAD-A007:804\Applications\MyCADApp\"; ValueType: string; ValueName: "InstallPath"; ValueData: "{app}"; Flags: uninsdeletekey; Check: RegKeyExists(HKLM, 'SOFTWARE\Autodesk\AutoCAD\19.0\ACAD-A007:804')
No need to "code", just call the built-in function. Though now you add the registry path twice. And you might need to do something for the 32/64 bit issue.
Notice that the object is instantiated through the Create constructor. But this means that you need to release it using the Free destructor.:-o
I hope I don't need to understand it?Nope, you need not "understand" it, just remember to do it (otherwise you end up with memory leaks).
Hi Irneb,Glad to. I had to try and remember some of the basics as I originally learned Borland TurboPascal in 1993. Have used variants of Pascal (Delphi & Lazarus) over the years, but it certainly isn't the language I use constantly. I haven't done much using Pascal Script, but the language is quite standard across the board - only need to search documentation (which isn't as comprehensive for PS as for other Pascals).
Fantastic tutorial! Taught me a lot. Many thanks for posting.
Autoloader is fine, but I have to serve also version beneath 2012 - so Autoloader can not serve these old versions.
;
; Demonstrates setup of demand loading code for LspLoad application - thanks to Owen Wengerd
; Download LspLoad.zip from: http://www.manusoft.com/software/freebies/arx.html
; Download Inno Setup: http://www.jrsoftware.org/isinfo.php/
;
[Setup]
AppName=MyApp
AppVersion=1.0
VersionInfoVersion=1.0
DefaultDirName={pf}\MyApp
DefaultGroupName=MyApp
DisableProgramGroupPage=true
AlwaysUsePersonalGroup=true
PrivilegesRequired=none
ArchitecturesInstallIn64BitMode=x64
WindowShowCaption=true
Uninstallable=yes
[Messages]
DiskSpaceMBLabel=The program requires at least [kb] KB of disk space.
[Dirs]
Name: {app}; Permissions: users-modify
[Files]
Source: MyApp.lsp; DestDir: {app}; Flags: touch
;; include OpenDCL runtime for your app if required
;; Source: OpenDCL.Runtime.7.0.0.13.msi; DestDir: {app}; Flags: ignoreversion
;; LspLoad file is renamed when copied to the installation directory to match the application name
;; Boolean functions GetVer and Is64Bit check appropriate file to install for the installation
Source: LspLoad.9.brx; DestDir: {app}; DestName: MyApp.9.brx; Check: GetVer(9)
Source: LspLoad.10.brx; DestDir: {app}; DestName: MyApp.10.brx; Check: GetVer(10)
Source: LspLoad.11.brx; DestDir: {app}; DestName: MyApp.11.brx; Check: GetVer(11)
Source: LspLoad.12.brx; DestDir: {app}; DestName: MyApp.12.brx; Check: GetVer(12)
Source: LspLoad.15.arx; DestDir: {app}; DestName: MyApp.15.arx; Check: GetVer(15)
Source: LspLoad.16.arx; DestDir: {app}; DestName: MyApp.16.arx; Check: GetVer(16)
Source: LspLoad.17.arx; DestDir: {app}; DestName: MyApp.17.arx; Check: not Is64Bit and GetVer(17)
Source: LspLoad.17.x64.arx; DestDir: {app}; DestName: MyApp.17.x64.arx; Check: Is64Bit and GetVer(17)
Source: LspLoad.18.arx; DestDir: {app}; DestName: MyApp.18.arx; Check: not Is64Bit and GetVer(18)
Source: LspLoad.18.x64.arx; DestDir: {app}; DestName: MyApp.18.x64.arx; Check: Is64Bit and GetVer(18)
Source: LspLoad.19.arx; DestDir: {app}; DestName: MyApp.19.arx; Check: not Is64Bit and GetVer(19)
Source: LspLoad.19.x64.arx; DestDir: {app}; DestName: MyApp.19.x64.arx; Check: Is64Bit and GetVer(19)
[Icons]
Name: {group}\Uninstall MyApp; Filename: {uninstallexe}; WorkingDir: {app};
[INI]
[InstallDelete]
[Registry]
;; Include path of installation in registry if required
;; Root: HKCU; Subkey: Software\MyAppCo\MyApp; ValueType: string; ValueName: InstallPath; ValueData: {app}; Flags: uninsdeletekey;
;; Insert demand loader entry for LspLoad.xx.arx
;; GetFilenm function retreives file name string
;; GetAcadAppReg gets registry path for HKCU
;; For HKLM (all users) you will need to Create a page in the setup wizard to select setup option -
;; either everyone or current user and create a function similar to GetAcadAppReg
;; Set LoadCtrls key to 12 for demand loading using command specified in Commands key (TestMyApp)
;; Set LoadCtrls key to 2 for load at AutoCAD startup
Root: HKCU; Subkey: {code:GetAcadAppReg}\Applications\MyApp; ValueType: string; ValueName: Description; ValueData: MyApp; Flags: uninsdeletekey;
Root: HKCU; Subkey: {code:GetAcadAppReg}\Applications\MyApp; ValueType: dword; ValueName: LoadCtrls; ValueData: 12; Flags: uninsdeletekey;
Root: HKCU; Subkey: {code:GetAcadAppReg}\Applications\MyApp; ValueType: string; ValueName: Loader; ValueData: {app}\{code:GetFilenm}; Flags: uninsdeletekey;
Root: HKCU; Subkey: {code:GetAcadAppReg}\Applications\MyApp\Commands; ValueType: string; ValueName: MyApp; ValueData: TestMyApp;
;;include OpenDCL runtime for your app if required
[Run]
;; Filename: msiexec.exe; Parameters: "/i ""{app}\OpenDCL.Runtime.7.0.0.13.msi"""
[UninstallRun]
;; Filename: msiexec.exe; Parameters: "/x ""{app}\OpenDCL.Runtime.7.0.0.13.msi"""
[Code]
// The following InitializeSetup function is a basic check for installation of AutoCAD or Bricscad.
// It doesn't allow for a choice if there are multiple installations on the same system and hasn't been tested extensively
// so may not work for products other than vanilla AutoCAD
var
App, Version, Product, Ver, Wow, AcadLocn: String;
function InitializeSetup (): Boolean;
begin //check for apps including AutoCAD, AutoCAD LT, Bricscad
if RegKeyExists(HKEY_CLASSES_ROOT, 'AutoCAD.Application') or RegKeyExists(HKEY_CLASSES_ROOT, 'AutoCADLT.Drawing') then
begin
RegQueryStringValue(HKEY_CLASSES_ROOT, 'AutoCAD.Application\CurVer','', Version)
if (Version = '') or RegKeyExists(HKEY_CLASSES_ROOT, 'AutoCADLT.Drawing\CurVer') then
begin
if RegValueExists(HKEY_CURRENT_USER, 'Software\Autodesk\AutoCAD LT','CurVer') then
MsgBox('AutoCAD LT is not supported, exiting install...', mbInformation, MB_OK) else
MsgBox('Can''t locate AutoCAD or Bricscad on this system, exiting install...', mbInformation, MB_OK)
Result := False;
end
else
if Version = 'BricscadApp.AcadApplication' then
begin
App := 'Bricscad'
RegQueryStringValue(HKEY_CURRENT_USER, 'Software\Bricsys\Bricscad','CURVER', Version)//Reassign variable Version
RegQueryStringValue(HKEY_CURRENT_USER, ('Software\Bricsys\Bricscad\' + Version),'CURVER', Product)//Assign the variable Product
RegQueryStringValue(HKEY_LOCAL_MACHINE, ('Software\Bricsys\Bricscad\' + Version + '\' + Product),'AcadLocation', AcadLocn)//AcadLocn
Wow := '0' //Flag
Ver := Version
Delete (Ver, 1, 1)//remove leading V
Result := True;
end
else
if Version = 'AutoCAD.Drawing.15' then
begin
App := 'AutoCAD'
RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\Autodesk\AutoCAD','CurVer', Version)
RegQueryStringValue(HKEY_LOCAL_MACHINE, ('Software\Autodesk\AutoCAD\' + Version),'CurVer', Product)
//Create a registry string as global 'Wow' to check later
if RegValueExists(HKEY_LOCAL_MACHINE, ('Software\Autodesk\AutoCAD\' + Version + '\' + Product), 'AcadLocation') then
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE, ('SOFTWARE\Autodesk\AutoCAD\' + Version + '\' + Product),'AcadLocation', AcadLocn)
Wow := '0'
end
else
if RegValueExists(HKEY_LOCAL_MACHINE, ('SOFTWARE\Wow6432Node\Autodesk\AutoCAD\' + Version + '\' + Product), 'AcadLocation') then
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE, ('SOFTWARE\Wow6432Node\Autodesk\AutoCAD\' + Version + '\' + Product),'AcadLocation', AcadLocn)
Wow := '1'
end
Ver := Version //create global
Delete (Ver, 4, 2)//remove trailing period and integer
Delete (Ver, 1, 1)//remove leading R
Result := True;
end
else
if RegValueExists(HKEY_CURRENT_USER, 'Software\Autodesk\AutoCAD','CurVer') then
begin
App := 'AutoCAD'
RegQueryStringValue(HKEY_CURRENT_USER, 'Software\Autodesk\AutoCAD','CurVer', Version)//get most recent accessed version regardless of installations
RegQueryStringValue(HKEY_CURRENT_USER, ('Software\Autodesk\AutoCAD\' + Version),'CurVer', Product)
//Check where registry entries are found to determine whether installation is 32 bit or 64 bit
if RegValueExists(HKEY_LOCAL_MACHINE, ('Software\Autodesk\AutoCAD\' + Version + '\' + Product), 'AcadLocation') then
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE, ('SOFTWARE\Autodesk\AutoCAD\' + Version + '\' + Product),'AcadLocation', AcadLocn)
Wow := '0'
end
else
if RegValueExists(HKEY_LOCAL_MACHINE, ('SOFTWARE\Wow6432Node\Autodesk\AutoCAD\' + Version + '\' + Product), 'AcadLocation') then
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE, ('SOFTWARE\Wow6432Node\Autodesk\AutoCAD\' + Version + '\' + Product),'AcadLocation', AcadLocn)
Wow := '1'
end
Ver := Version //create global
Delete (Ver, 4, 2)//remove trailing period and integer
Delete (Ver, 1, 1)//remove leading R
Result := True; //flag install to continue
end
else
begin
MsgBox('Can''t locate AutoCAD or Bricscad on this system, exiting install...', mbInformation, MB_OK)
Result := False;
end
end
else
begin
MsgBox('Can''t locate AutoCAD or Bricscad on this system, exiting install...', mbInformation, MB_OK)
Result := False;
end
end;
function GetFileNm(FileNm: String): String;
begin
if 'AutoCAD' = App then
begin
case Ver of
'15' : FileNm := 'MyApp.15.arx';
'16' : FileNm := 'MyApp.16.arx';
//check if the 'Wow' flag is set to '1' if so the installation is a 32bit version on a 64bit OS
'17' : if Wow = '1' then
FileNm := 'MyApp.17.arx' else
//installation is under a 64bit or 32bit OS
if isWin64 then
FileNm := 'MyApp.17.x64.arx' else
FileNm := 'MyApp.17.arx';
'18' : if Wow = '1' then
FileNm := 'MyApp.18.arx' else
if isWin64 then
FileNm := 'MyApp.18.x64.arx' else
FileNm := 'MyApp.18.arx';
'19' : if Wow = '1' then
FileNm := 'MyApp.19.arx' else
if isWin64 then
FileNm := 'MyApp.19.x64.arx' else
FileNm := 'MyApp.19.arx';
end;
Result := FileNm
end
else
begin
//Bricscad ...
case Ver of
'12' : FileNm := 'MyApp.12.brx';
'11' : FileNm := 'MyApp.11.brx';
'10' : FileNm := 'MyApp.10.brx';
'9' : FileNm := 'MyApp.9.brx';
end;
Result := FileNm
end
end;
function GetAcadAppReg (RegPath: String): String;
begin
if 'AutoCAD' = App then
begin
RegPath := ('Software\Autodesk\AutoCAD\' + Version + '\' + Product)
Result := RegPath
end
else
begin
//Must be Bricscad
RegPath := ('Software\Bricsys\Bricscad\' + Version + '\' + Product)
Result := RegPath
end
end;
function GetVer (Param: Integer): Boolean;
begin
if Param = StrToInt(Ver) then
Result := True else
Result := False
end;
function Is64Bit (): Boolean;
begin
if Wow = '1' then
Result := False else
if isWin64 then
Result := True else
Result := False
end;
...PS.:http://www.cadwerx.net not available!...Yes. Regrettably Byron stopped his developments.
...Found it http://www.freecadapps.com/swdetails.php?value=ACG-MSC&orgvalue=ACG&review=5626&rowcolor=fce08dThe problem is that this version is 1.2 from 2002. A lot has changed since then in Acad environment.
acadInst.exe & AcadInst_x64.exe v1.7.0.48 (cuix files are not supported):Wonderful. Thanks a lot.
:-o oh I not realy understand what I do
Simple question: what should do actually acadinst.exe and .ini. If I compile iss I get this message. I did change shortcut to example "C:\Programme\AutoCAD 2002\AcadInst.exe" "Infrastructure" (that create a new supportpath with named Infrastructure)
Jar: can I get newest acadinst.exe or where I can find them?Did you take the download from his posting
...I have same message again
...Maybe a nother problem I have, in acadinst.ini are R15 or 16 version. I work with 2013 so it doesn´t run on this version or?I don't know, but ..
[Icons]
Name: "{group}\AddIn"; Filename: "{code:GetAutoCADExe}\acad.exe"; Parameters: "{code:CheckCivil3DAecBaseDbxExists|{code:GetAutoCADExe}}/p ""AddIn"""; WorkingDir: "{app}"; IconFilename: "{app}\Bp.ico"
type
AUTOCADINFO = record
location: AnsiString;
productname: AnsiString;
productid: AnsiString;
serialnumber: AnsiString;
end;
AcadInfoArray = array of AUTOCADINFO;
// Global variables
var
AcadVerNames, AcadVerKeys, AcadExes, AcadProductNames: TArrayOfString;
AcadInfos: AcadInfoArray;
function GetInstalledAutoCADVersions(): Boolean;
var
S, V, AcadRegKey, sAcadExeLocation, sProductName, sProductId, sSerialNumber: String;
RootKey, I, J, iCountAcadExeLocations: Integer;
AcadVerKeysTemp: TArrayOfString;
AcadInfo: AUTOCADINFO;
begin
if IsWin64 then
begin
RootKey := HKLM64;
end
else
begin
RootKey := HKEY_LOCAL_MACHINE;
end;
iCountAcadExeLocations := 0;
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], AcadVerKeysTemp) then
begin
for J := 0 to GetArrayLength(AcadVerKeysTemp)-1 do
begin
//SOFTWARE\Autodesk\AutoCAD\R17.2\ACAD-7000:409
//MsgBox(AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J], mbInformation, MB_OK);
sAcadExeLocation := '';
if RegQueryStringValue(RootKey, AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J], 'Location', sAcadExeLocation) then
begin
SetArrayLength(AcadExes, iCountAcadExeLocations + 1);
AcadExes[iCountAcadExeLocations] := sAcadExeLocation;
SetArrayLength(AcadVerKeys, iCountAcadExeLocations + 1);
AcadVerKeys[iCountAcadExeLocations] := AcadVerKeysTemp[J];
//S := S + AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeys[J] + ' = ' + AcadExes[I] + #13#10;
SetArrayLength(AcadProductNames, iCountAcadExeLocations+1);
AcadProductNames[iCountAcadExeLocations] := GetAutoCADProductName(AcadVerKeysTemp[J]);
//---- Test of own array ----
sProductName := '';
sProductId := '';
sSerialNumber := '';
SetArrayLength(AcadInfos, iCountAcadExeLocations + 1);
AcadInfo.location := sAcadExeLocation;
if RegQueryStringValue(RootKey, AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J], 'ProductName', sProductName) then
begin
AcadInfo.productname := sProductName;
end;
if RegQueryStringValue(RootKey, AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J], 'ProductId', sProductId) then
begin
AcadInfo.productid := sProductId;
end;
if RegQueryStringValue(RootKey, AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J], 'SerialNumber', sSerialNumber) then
begin
AcadInfo.serialnumber := sSerialNumber;
end;
AcadInfos[iCountAcadExeLocations] := AcadInfo;
//MsgBox('Location = ' + AcadInfo.location + #13#10 + 'ProductName = ' + AcadInfo.productname + #13#10 + 'ProductId = ' + AcadInfo.productid + #13#10 + 'SerialNumber = ' + AcadInfo.serialnumber + #13#10, mbInformation, MB_OK);
//---- Test of own array ----
iCountAcadExeLocations := iCountAcadExeLocations + 1;
end;
end;
end;
end;
//MsgBox('Founded AutoCAD registry keys:'#13#10#13#10 + S, mbInformation, MB_OK);
end;
end;
// Function implementations
function GetAutoCADExe(Param: String): String;
begin
Result := AcadInfos[SelectAutoCADPage.SelectedValueIndex].location;
end;
procedure InitializeWizard;
var
iCountAcadProductNames, I: Integer;
button : TButton;
begin
// AutoCAD version selection dialog
SelectAutoCADPage := CreateInputOptionPage(wpWelcome,
'Choose AutoCAD version', 'Upon which version of AutoCAD do you install addin?',
'Choose AutoCAD version and click Next.',
True, False);
iCountAcadProductNames := GetArrayLength(AcadProductNames);
for I := 0 to iCountAcadProductNames-1 do
begin
//SelectAutoCADPage.Add(AcadProductNames[I]);
SelectAutoCADPage.Add(AcadInfos[I].productname);
end;
end;
function InitializeSetup(): Boolean;
begin;
GetInstalledAutoCADVersions();
Result := True;
end;
...Code is not a final version and could have bugs. ...Thanks. We are looking forward at the final version. ;-)
[Icons]
Name: "{group}\KHK"; Filename: "{code:GetAutoCADExe}\acad.exe"; WorkingDir: "{app}"; IconFilename: "{app}\Bp.ico"; Parameters: "{code:CheckAutoCADStartupParameters}/p ""KHK"""
[Run]
Filename: "{app}\CopyRegKey.bat"; Parameters: """HKEY_CURRENT_USER\{code:GetTemplateProfileRegKey}"""; WorkingDir: "{app}"; Flags: waituntilterminated; StatusMsg: "Kopioi ja luo AutoCAD profiilit..."; AfterInstall: ModifyKHKProfileRegFile
Filename: "{app}\ImportRegKey.bat"; Parameters: "KHK"; WorkingDir: "{app}"; Flags: waituntilterminated; StatusMsg: "Palauttaa ja muokkaa AutoCAD profiileja..."; AfterInstall: ModifyKHKProfile
[Code]
// Global type definitions
type
AUTOCADINFO = record
location: AnsiString;
productname: AnsiString;
productid: AnsiString;
serialnumber: AnsiString;
registrykey: AnsiString;
end;
AcadInfoArray = array of AUTOCADINFO;
// Global variables
var
SelectAutoCADPage: TInputOptionWizardPage;
AcadInfos: AcadInfoArray;
RootKey: Integer;
// Function declarations
function GetInstalledAutoCADVersions(): Boolean; forward;
function GetAutoCADProductName(Param: String): String; forward;
// Function implementations
function InitializeSetup(): Boolean;
var
bRes: Boolean;
begin;
bRes := False;
Log('InitializeSetup() called');
bRes := GetInstalledAutoCADVersions();
if bRes = False then begin
MsgBox('Koneelta ei löytynyt asennettua AutoCAD -ohjelmaa.' + #13#10 + 'Asennus lopetetaan.', mbInformation, MB_OK);
end;
Result := bRes;
end;
procedure InitializeWizard;
var
iCountAcadProductNames, I: Integer;
button : TButton;
begin
Log('InitializeWizard() called');
// AutoCAD version selection dialog
SelectAutoCADPage := CreateInputOptionPage(wpWelcome, 'AutoCAD version valinta', 'Minkä AutoCAD:n päälle ohjelmisto asennetaan?',
'Valitse AutoCAD versio ja paina Seuraava.', True, False);
iCountAcadProductNames := GetArrayLength(AcadInfos);
for I := 0 to iCountAcadProductNames - 1 do
begin
SelectAutoCADPage.Add(AcadInfos[I].productname);
end;
function GetInstalledAutoCADVersions(): Boolean;
var
S, V, AcadRegKey, sAcadExeLocation, sProductName, sProductId, sSerialNumber, sRegistryKey: String;
I, J, iCountAcadExeLocations: Integer;
AcadVerNames, AcadVerKeysTemp: TArrayOfString;
AcadInfo: AUTOCADINFO;
begin
if IsWin64 then begin
RootKey := HKLM64;
end else begin
RootKey := HKEY_LOCAL_MACHINE;
end;
iCountAcadExeLocations := 0;
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], AcadVerKeysTemp) then
begin
for J := 0 to GetArrayLength(AcadVerKeysTemp)-1 do
begin
//SOFTWARE\Autodesk\AutoCAD\R17.2\ACAD-7000:409
//MsgBox(AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J], mbInformation, MB_OK);
sAcadExeLocation := '';
sRegistryKey := AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J];
if RegQueryStringValue(RootKey, AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J], 'Location', sAcadExeLocation) then
begin
sProductName := '';
sProductId := '';
sSerialNumber := '';
SetArrayLength(AcadInfos, iCountAcadExeLocations + 1);
AcadInfo.location := sAcadExeLocation;
if RegQueryStringValue(RootKey, AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J], 'ProductName', sProductName) then begin
AcadInfo.productname := sProductName;
end;
if RegQueryStringValue(RootKey, AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J], 'ProductId', sProductId) then begin
AcadInfo.productid := sProductId;
end;
if RegQueryStringValue(RootKey, AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J], 'SerialNumber', sSerialNumber) then begin
AcadInfo.serialnumber := sSerialNumber;
end;
AcadInfo.registrykey := sRegistryKey;
AcadInfos[iCountAcadExeLocations] := AcadInfo;
//MsgBox('Location = ' + AcadInfo.location + #13#10 + 'ProductName = ' + AcadInfo.productname + #13#10 + 'ProductId = ' + AcadInfo.productid + #13#10 + 'SerialNumber = ' + AcadInfo.serialnumber + #13#10, mbInformation, MB_OK);
iCountAcadExeLocations := iCountAcadExeLocations + 1;
end;
end;
end;
end;
//MsgBox('Founded AutoCAD registry keys:'#13#10#13#10 + S, mbInformation, MB_OK);
end;
if iCountAcadExeLocations > 0 then begin
Result := True;
end else begin
Result := False;
end;
end;
function GetAutoCADProductName(Param: String): String;
var
sRet: String;
begin
// AutoCAD 2012
if Param = 'ACAD-A000:409' then begin
sRet := 'Autodesk Civil 3D 2012';
end else if Param = 'ACAD-A001:409' then begin
sRet := 'AutoCAD 2012';
end else if Param = 'ACAD-A002:409' then begin
sRet := 'Autodesk Map 3D 2012';
// AutoCAD 2013
end else if Param = 'ACAD-B000:409' then begin
sRet := 'Autodesk Civil 3D 2013';
end else if Param = 'ACAD-B001:409' then begin
sRet := 'AutoCAD 2013';
end else if Param = 'ACAD-B002:409' then begin
sRet := 'Autodesk Map 3D 2013';
// AutoCAD 2009
end else if Param = 'ACAD-7000:409' then begin
sRet := 'Autodesk Civil 3D 2009';
end else if Param = 'ACAD-7001:409' then begin
sRet := 'AutoCAD 2009';
end else if Param = 'ACAD-7002:409' then begin
sRet := 'Autodesk Map 3D 2009';
// AutoCAD 2010
end else if Param = 'ACAD-8000:409' then begin
sRet := 'Autodesk Civil 3D 2010';
end else if Param = 'ACAD-8001:409' then begin
sRet := 'AutoCAD 2010';
end else if Param = 'ACAD-8002:409' then begin
sRet := 'Autodesk Map 3D 2010';
// AutoCAD 2011
end else if Param = 'ACAD-9000:409' then begin
sRet := 'Autodesk Civil 3D 2011';
end else if Param = 'ACAD-9001:409' then begin
sRet := 'AutoCAD 2011';
end else if Param = 'ACAD-9002:409' then begin
sRet := 'Autodesk Map 3D 2011';
// AutoCAD 2014
end else if Param = 'ACAD-D000:409' then begin
sRet := 'Autodesk Civil 3D 2014';
end else if Param = 'ACAD-D001:409' then begin
sRet := 'AutoCAD 2014';
end else if Param = 'ACAD-D002:409' then begin
sRet := 'Autodesk Map 3D 2014';
// AutoCAD 2015
end else if Param = 'ACAD-E000:409' then begin
sRet := 'Autodesk Civil 3D 2015';
end else if Param = 'ACAD-E001:409' then begin
sRet := 'AutoCAD 2015';
end else if Param = 'ACAD-E002:409' then begin
sRet := 'Autodesk Map 3D 2015';
// AutoCAD 2016
end else if Param = 'ACAD-F000:409' then begin
sRet := 'Autodesk Civil 3D 2016';
end else if Param = 'ACAD-F001:409' then begin
sRet := 'AutoCAD 2016';
end else if Param = 'ACAD-F002:409' then begin
sRet := 'Autodesk Map 3D 2016';
// Something other AutoCAD version
end else begin
sRet := 'Tuntematon AutoCAD versio: ' + Param;
end;
//MsgBox('GetAutoCADProductName(' + Param + ') = ' + sRet, mbInformation, MB_OK);
Result := sRet;
end;
function GetAutoCADExe(Param: String): String;
begin
Result := AcadInfos[SelectAutoCADPage.SelectedValueIndex].location;
end;
function GetTemplateProfileRegKey(Param: String): String;
var
prodId, regkey: String;
begin
prodId := AcadInfos[SelectAutoCADPage.SelectedValueIndex].productid;
regkey := AcadInfos[SelectAutoCADPage.SelectedValueIndex].registrykey;
Log('CheckAutoCADStartupParameters prodId: ' + prodId);
if prodId = 'F000' then begin // Civil 3D 2016
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else if prodId = 'E000' then begin // Civil 3D 2015
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else if prodId = 'D000' then begin // Civil 3D 2014
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else if prodId = 'B000' then begin // Civil 3D 2013
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else if prodId = 'A000' then begin // Civil 3D 2012
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else if prodId = '9000' then begin // Civil 3D 2011
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else if prodId = '8000' then begin // Civil 3D 2010
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else if prodId = '7000' then begin // Civil 3D 2009
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else begin
Result := regkey + '\Profiles\<<Unnamed Profile>>';
end;
end;
function CheckAutoCADStartupParameters(Param: String): String;
var
prodId, path: String;
begin
prodId := AcadInfos[SelectAutoCADPage.SelectedValueIndex].productid;
path := AcadInfos[SelectAutoCADPage.SelectedValueIndex].location;
Log('CheckAutoCADStartupParameters prodId: ' + prodId);
Log('CheckAutoCADStartupParameters location: ' + path);
if prodId = 'F000' then begin // Civil 3D 2016
Result := '/ld "' + path + '\AecBase.dbx" /product "C3D" ';
end else if prodId = 'F002' then begin // Map 3D 2016
Result := '/product MAP /language "en-US" ';
end else if prodId = 'E000' then begin // Civil 3D 2015
Result := '/ld "' + path + '\AecBase.dbx" /product "C3D" ';
end else if prodId = 'D000' then begin // Civil 3D 2014
Result := '/ld "' + path + '\AecBase.dbx" ';
end else if prodId = 'B000' then begin // Civil 3D 2013
Result := '/ld "' + path + '\AecBase.dbx" ';
end else if prodId = 'A000' then begin // Civil 3D 2012
Result := '/ld "' + path + '\AecBase.dbx" ';
end else if prodId = '9000' then begin // Civil 3D 2011
Result := '/ld "' + path + '\AecBase.dbx" ';
end else if prodId = '8000' then begin // Civil 3D 2010
Result := '/ld "' + path + '\AecBase.dbx" ';
end else if prodId = '7000' then begin // Civil 3D 2009
Result := '/ld "' + path + '\AecBase.dbx" ';
end else begin
Result := '';
end;
end;
Hi Veli, this topic is old and I hope you see my post. thank you for your great project of Inno Setup, I could perform a project in inno setup with your functions. now I extremely need to copy a single file like a font to all Locations of Autocad. is it possible?
Hi,
I have almost finished my installation project with Inno Setup. Setup package is in 32bit mode because it has 32bit dlls to register in Windows environment. Original idea was to detect AutoCAD version and install 3rd addin upon selected version. It also creates AutoCAD profiles and configures them. I don´t know is this a right way to do it but it is a one way. Have a good coding! =)
This is only a part of code because of 20000 characters limit. If someone need rest of it I can put it in .iss file.Code: [Select][Icons]
Name: "{group}\KHK"; Filename: "{code:GetAutoCADExe}\acad.exe"; WorkingDir: "{app}"; IconFilename: "{app}\Bp.ico"; Parameters: "{code:CheckAutoCADStartupParameters}/p ""KHK"""
[Run]
Filename: "{app}\CopyRegKey.bat"; Parameters: """HKEY_CURRENT_USER\{code:GetTemplateProfileRegKey}"""; WorkingDir: "{app}"; Flags: waituntilterminated; StatusMsg: "Kopioi ja luo AutoCAD profiilit..."; AfterInstall: ModifyKHKProfileRegFile
Filename: "{app}\ImportRegKey.bat"; Parameters: "KHK"; WorkingDir: "{app}"; Flags: waituntilterminated; StatusMsg: "Palauttaa ja muokkaa AutoCAD profiileja..."; AfterInstall: ModifyKHKProfile
[Code]
// Global type definitions
type
AUTOCADINFO = record
location: AnsiString;
productname: AnsiString;
productid: AnsiString;
serialnumber: AnsiString;
registrykey: AnsiString;
end;
AcadInfoArray = array of AUTOCADINFO;
// Global variables
var
SelectAutoCADPage: TInputOptionWizardPage;
AcadInfos: AcadInfoArray;
RootKey: Integer;
// Function declarations
function GetInstalledAutoCADVersions(): Boolean; forward;
function GetAutoCADProductName(Param: String): String; forward;
// Function implementations
function InitializeSetup(): Boolean;
var
bRes: Boolean;
begin;
bRes := False;
Log('InitializeSetup() called');
bRes := GetInstalledAutoCADVersions();
if bRes = False then begin
MsgBox('Koneelta ei löytynyt asennettua AutoCAD -ohjelmaa.' + #13#10 + 'Asennus lopetetaan.', mbInformation, MB_OK);
end;
Result := bRes;
end;
procedure InitializeWizard;
var
iCountAcadProductNames, I: Integer;
button : TButton;
begin
Log('InitializeWizard() called');
// AutoCAD version selection dialog
SelectAutoCADPage := CreateInputOptionPage(wpWelcome, 'AutoCAD version valinta', 'Minkä AutoCAD:n päälle ohjelmisto asennetaan?',
'Valitse AutoCAD versio ja paina Seuraava.', True, False);
iCountAcadProductNames := GetArrayLength(AcadInfos);
for I := 0 to iCountAcadProductNames - 1 do
begin
SelectAutoCADPage.Add(AcadInfos[I].productname);
end;
function GetInstalledAutoCADVersions(): Boolean;
var
S, V, AcadRegKey, sAcadExeLocation, sProductName, sProductId, sSerialNumber, sRegistryKey: String;
I, J, iCountAcadExeLocations: Integer;
AcadVerNames, AcadVerKeysTemp: TArrayOfString;
AcadInfo: AUTOCADINFO;
begin
if IsWin64 then begin
RootKey := HKLM64;
end else begin
RootKey := HKEY_LOCAL_MACHINE;
end;
iCountAcadExeLocations := 0;
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], AcadVerKeysTemp) then
begin
for J := 0 to GetArrayLength(AcadVerKeysTemp)-1 do
begin
//SOFTWARE\Autodesk\AutoCAD\R17.2\ACAD-7000:409
//MsgBox(AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J], mbInformation, MB_OK);
sAcadExeLocation := '';
sRegistryKey := AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J];
if RegQueryStringValue(RootKey, AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J], 'Location', sAcadExeLocation) then
begin
sProductName := '';
sProductId := '';
sSerialNumber := '';
SetArrayLength(AcadInfos, iCountAcadExeLocations + 1);
AcadInfo.location := sAcadExeLocation;
if RegQueryStringValue(RootKey, AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J], 'ProductName', sProductName) then begin
AcadInfo.productname := sProductName;
end;
if RegQueryStringValue(RootKey, AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J], 'ProductId', sProductId) then begin
AcadInfo.productid := sProductId;
end;
if RegQueryStringValue(RootKey, AcadRegKey + '\' + AcadVerNames[I] + '\' + AcadVerKeysTemp[J], 'SerialNumber', sSerialNumber) then begin
AcadInfo.serialnumber := sSerialNumber;
end;
AcadInfo.registrykey := sRegistryKey;
AcadInfos[iCountAcadExeLocations] := AcadInfo;
//MsgBox('Location = ' + AcadInfo.location + #13#10 + 'ProductName = ' + AcadInfo.productname + #13#10 + 'ProductId = ' + AcadInfo.productid + #13#10 + 'SerialNumber = ' + AcadInfo.serialnumber + #13#10, mbInformation, MB_OK);
iCountAcadExeLocations := iCountAcadExeLocations + 1;
end;
end;
end;
end;
//MsgBox('Founded AutoCAD registry keys:'#13#10#13#10 + S, mbInformation, MB_OK);
end;
if iCountAcadExeLocations > 0 then begin
Result := True;
end else begin
Result := False;
end;
end;
function GetAutoCADProductName(Param: String): String;
var
sRet: String;
begin
// AutoCAD 2012
if Param = 'ACAD-A000:409' then begin
sRet := 'Autodesk Civil 3D 2012';
end else if Param = 'ACAD-A001:409' then begin
sRet := 'AutoCAD 2012';
end else if Param = 'ACAD-A002:409' then begin
sRet := 'Autodesk Map 3D 2012';
// AutoCAD 2013
end else if Param = 'ACAD-B000:409' then begin
sRet := 'Autodesk Civil 3D 2013';
end else if Param = 'ACAD-B001:409' then begin
sRet := 'AutoCAD 2013';
end else if Param = 'ACAD-B002:409' then begin
sRet := 'Autodesk Map 3D 2013';
// AutoCAD 2009
end else if Param = 'ACAD-7000:409' then begin
sRet := 'Autodesk Civil 3D 2009';
end else if Param = 'ACAD-7001:409' then begin
sRet := 'AutoCAD 2009';
end else if Param = 'ACAD-7002:409' then begin
sRet := 'Autodesk Map 3D 2009';
// AutoCAD 2010
end else if Param = 'ACAD-8000:409' then begin
sRet := 'Autodesk Civil 3D 2010';
end else if Param = 'ACAD-8001:409' then begin
sRet := 'AutoCAD 2010';
end else if Param = 'ACAD-8002:409' then begin
sRet := 'Autodesk Map 3D 2010';
// AutoCAD 2011
end else if Param = 'ACAD-9000:409' then begin
sRet := 'Autodesk Civil 3D 2011';
end else if Param = 'ACAD-9001:409' then begin
sRet := 'AutoCAD 2011';
end else if Param = 'ACAD-9002:409' then begin
sRet := 'Autodesk Map 3D 2011';
// AutoCAD 2014
end else if Param = 'ACAD-D000:409' then begin
sRet := 'Autodesk Civil 3D 2014';
end else if Param = 'ACAD-D001:409' then begin
sRet := 'AutoCAD 2014';
end else if Param = 'ACAD-D002:409' then begin
sRet := 'Autodesk Map 3D 2014';
// AutoCAD 2015
end else if Param = 'ACAD-E000:409' then begin
sRet := 'Autodesk Civil 3D 2015';
end else if Param = 'ACAD-E001:409' then begin
sRet := 'AutoCAD 2015';
end else if Param = 'ACAD-E002:409' then begin
sRet := 'Autodesk Map 3D 2015';
// AutoCAD 2016
end else if Param = 'ACAD-F000:409' then begin
sRet := 'Autodesk Civil 3D 2016';
end else if Param = 'ACAD-F001:409' then begin
sRet := 'AutoCAD 2016';
end else if Param = 'ACAD-F002:409' then begin
sRet := 'Autodesk Map 3D 2016';
// Something other AutoCAD version
end else begin
sRet := 'Tuntematon AutoCAD versio: ' + Param;
end;
//MsgBox('GetAutoCADProductName(' + Param + ') = ' + sRet, mbInformation, MB_OK);
Result := sRet;
end;
function GetAutoCADExe(Param: String): String;
begin
Result := AcadInfos[SelectAutoCADPage.SelectedValueIndex].location;
end;
function GetTemplateProfileRegKey(Param: String): String;
var
prodId, regkey: String;
begin
prodId := AcadInfos[SelectAutoCADPage.SelectedValueIndex].productid;
regkey := AcadInfos[SelectAutoCADPage.SelectedValueIndex].registrykey;
Log('CheckAutoCADStartupParameters prodId: ' + prodId);
if prodId = 'F000' then begin // Civil 3D 2016
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else if prodId = 'E000' then begin // Civil 3D 2015
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else if prodId = 'D000' then begin // Civil 3D 2014
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else if prodId = 'B000' then begin // Civil 3D 2013
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else if prodId = 'A000' then begin // Civil 3D 2012
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else if prodId = '9000' then begin // Civil 3D 2011
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else if prodId = '8000' then begin // Civil 3D 2010
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else if prodId = '7000' then begin // Civil 3D 2009
Result := regkey + '\Profiles\<<C3D_Metric>>';
end else begin
Result := regkey + '\Profiles\<<Unnamed Profile>>';
end;
end;
function CheckAutoCADStartupParameters(Param: String): String;
var
prodId, path: String;
begin
prodId := AcadInfos[SelectAutoCADPage.SelectedValueIndex].productid;
path := AcadInfos[SelectAutoCADPage.SelectedValueIndex].location;
Log('CheckAutoCADStartupParameters prodId: ' + prodId);
Log('CheckAutoCADStartupParameters location: ' + path);
if prodId = 'F000' then begin // Civil 3D 2016
Result := '/ld "' + path + '\AecBase.dbx" /product "C3D" ';
end else if prodId = 'F002' then begin // Map 3D 2016
Result := '/product MAP /language "en-US" ';
end else if prodId = 'E000' then begin // Civil 3D 2015
Result := '/ld "' + path + '\AecBase.dbx" /product "C3D" ';
end else if prodId = 'D000' then begin // Civil 3D 2014
Result := '/ld "' + path + '\AecBase.dbx" ';
end else if prodId = 'B000' then begin // Civil 3D 2013
Result := '/ld "' + path + '\AecBase.dbx" ';
end else if prodId = 'A000' then begin // Civil 3D 2012
Result := '/ld "' + path + '\AecBase.dbx" ';
end else if prodId = '9000' then begin // Civil 3D 2011
Result := '/ld "' + path + '\AecBase.dbx" ';
end else if prodId = '8000' then begin // Civil 3D 2010
Result := '/ld "' + path + '\AecBase.dbx" ';
end else if prodId = '7000' then begin // Civil 3D 2009
Result := '/ld "' + path + '\AecBase.dbx" ';
end else begin
Result := '';
end;
end;
Cheers
Veli
Thank you for replying, I could do the first part of that, so that now I have an array of all installed Autocad locations, but how can I copy fonts to each location of Autocad?