Using Inno Setup 5.5.2 I am trying to conditionally skip the selection of the installation directory depending on the availability of the path. In particular, if the "D: \" drive is available, I want to install it in a predefined location without prompts, and if it is not available, specify prompts with a reasonable default value.
I have code that works for DefaultDirName but not for DisableDirPage :
[Code] const DefaultDrive = 'D:\'; AppFolder = 'SomeDir'; function GetDefaultDir( Param: String ) : String; begin if DirExists( DefaultDrive ) then begin Result := DefaultDrive + AppFolder; end else begin Result := ExpandConstant('{pf}\') + AppFolder; end; end; function DefaultDirValid( Param: String ) : Boolean; begin Result := DirExists( DefaultDrive ); end; [Setup] ; Works as expected DefaultDirName={code:GetDefaultDir} ... ; Compiler Error - Value of [Setup] section directive "DisableDirPage" is invalid. DisableDirPage={code:DefaultDirValid}
I tried using functions for DisableDirPage that return yes and no strings, as well as integers from 0 and 1. I also tried to include a call to DirExists . All of them threw the same compiler error.
My best guess is that this is because DisableDirPage accepts a tri-state of yes, no, or auto. Is there a specific type associated with the tri-state logic that needs to be returned? Inno's help on Scripted Constants only says:
The called function should have 1 String parameter named Param and should return a String or Boolean value depending on where the constant is used.
source share