I am using Inno Setup to create an installer for my application. The installer is very simple and just copies some files. It works very well and I am pleased with it.
I recently implemented USB support and you need to install the USB driver from the IVI stock. This is an exe file that must be run somewhere during the installation process. Until now, the user must install the drivers separately, which is not so elegant. My first approach was as follows:
[Run] Filename: "{app}\driver\IviSharedComponents_2.2.1.exe"; Description: "Install USB driver (IVI Foundation)"; Flags: postinstall skipifsilent Filename: "{app}\driver\IviSharedComponents64_2.2.1.exe"; Description: "Install 64bit USB driver (IVI Foundation)"; Flags: postinstall skipifsilent Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, "&", "&&")}}"; Flags: postinstall skipifsilent
This works, but the user must select the correct bit. The advantage here is that he can choose not to install it (in this case, the application simply ignores the USB functionality, which is fine). In fact, I want the system to automatically detect the bit system and start the configuration process. It should not be in the [Run]
section, although I would have nothing against it (because the user may not install it).
I also found the code and tried to run it as follows:
[Code] procedure CurStepChanged (CurStep: TSetupStep); var WorkingDir: String; ReturnCode: Integer; begin if (ssInstall = CurStep) then Log('Starting driver installation'); WorkingDir := ExpandConstant ('{app}\driver'); Exec ('IviSharedComponents_2.2.1.exe', '', WorkingDir, SW_SHOW, ewWaitUntilTerminated, ReturnCode); end;
But this does not start the installation (although I see the log entry "Launch driver installation"). Is there something wrong with my path? What am I doing wrong and how can I change this script to automatically select the correct executable depending on the bit size?
EDIT: I used the proposed solution with the [Tasks]
entry. The implementation looks like this (for reference only):
[Tasks] Name: "install_usb"; Description: "Install USB drivers (IVI Foundation)"; GroupDescription: "External drivers:"; [Run] Filename: "{app}\driver\IviSharedComponents_2.2.1.exe"; StatusMsg: "Installing USB driver (IVI Foundation)"; Check: Not IsWin64(); Tasks: install_usb; Flags: skipifsilent Filename: "{app}\driver\IviSharedComponents64_2.2.1.exe"; StatusMsg: "Installing USB driver (IVI Foundation)"; Check: IsWin64(); Tasks: install_usb; Flags: skipifsilent
This works very well, thanks for your help!