3

Normally I build my installers on my "normal" PC in the office, and the EXEs are then stored on the company NAS.

Now (Corona, homeoffice) I modified the installer scripts. I added a #define NoNetwork, so the office-network is not needed.

At the moment I need to active the define when I build the installer at home and comment it out when I build the installer in the office.

Is there a way to activate a define only when on the machine where the installer is compiled/created a certain registry key is set (or a special file exists, or....) So that I don't have to modify the install script every time I switch from home to office?

Thanks!

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
ralfiii
  • 584
  • 4
  • 13

1 Answers1

3

To test for a file existence, use #ifexist directive:

#ifexist "C:\some\path\NoNetwork"
#define NoNetwork
#endif

To test for a registry value, use of #if directive and ReadReg function:

#if ReadReg(HKCU, "Registry\Key", "NoNetwork", 0) == 1
#define NoNetwork
#endif

Though if you are using some build script, you should use command-line options to customize the build, like:

iscc -DNoNetwork Example1.iss

See also How do I build two different installers from the same script in Inno Setup?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992