Conditional file output?
Here's what I'd like my installer to do:
1) Get a particular value from a key in registry - eg 1, 2, 3
2) I have files packed in the installer, all named with the possible values above as suffixes - eg File1, File2, File3
3) So if the value read from Reg is '3', the installer extracts File3. If it reads '1', the installer extracts File1 etc.
I know I could just write StrCmp conditional statements to check every possible value and accordingly extract the corresponding file... but I have >20 of these files/possible values so I don't really feel like writing conditional statements for each one.
Any 'elegant' way to do this?
I've tried the following-
ReadRegStr $1 HKLM "Software\XYZ" "Value"
File "File$1"
I understand this doesn't work because variables like $1 are only processed during runtime, and the compiler returns an error saying it can't find File$1 anyway.
So I tried this-
ReserveFile File1
ReserveFile File2
ReserveFile File3
.
.
.
.
ReserveFile File(last file id)
ReadRegStr $1 HKLM "Software\XYZ" "Value"
File /nonfatal "File$1"
In this case the compiler doesn't return an error, but the installer doesn't extract anything at runtime...