More Details:
Currently usign Advanced Installer 9.7 Enterprise in Trial mode as we evaluate if this product can meet our requirements.
I need to return a string value back from the INI file. This represents the Database compatability version (which I'll later use in a query against the database to determine if the application will be allowed to be installed).
I have added a custom action I called 'ReadINI' and added it's execution it to the PrepareDlg. This seemed to be the best place as I had planned on displaying the DB compatability requirement on the WelcomeDlg, and I thought putting it early in the process would ensure that it was made available before anything else was instantiated. However, there is a small dialog pop up that shows a warning symbol and the error "Selection Manager not initialized"... so perhaps this is misplaced.
The actual process however, is still a problem. As the VBScript custom actions can only return numeric responses, and based on another article, I'm returning the result by setting the "session.property" . as such:
Code: Select all
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("InstallInfo.ini",1)
set wshShell = CreateObject( "WScript.Shell" )
Set wshSystemEnv = wshShell.Environment( "SYSTEM" )
Do Until objFile.AtEndOfStream
strNextLine = trim(objFile.Readline)
if ( instr(strNextLine,"=") > 0 ) then
SplitArg=split(strNextLine,"=")
if SplitArg(0) = "CompatibleDBVersion" then
call CreateEnvVar("INSTALLER_DBVersion" , SplitArg(1) )
end if
end if
loop
set wshSystemEnv = nothing
set wshShell = nothing
set objFile = nothing
set objFSO = nothing
sub CreateEnvVar(strVarName,strVarValue)
' if (Ucase(Right((wscript.FullName),11)) <> "CSCRIPT.EXE") then
Session.Property(strVarName) = strVarValue
' else
' wscript.echo "Would set " & strVarName & " to " & strVarValue
' end if
end sub
(I've structured it like this so that I can return other information from the INI at a later time)
And in order for the result to be picked up, I've created a property
Name: [INSTALLER_DBVersion]
Value :initval
When I attempt to show the property I've created (next dialog), the value that shows as 'initval'. Either the script isnt being triggered (perhaps this is what the error dialog is telling me?) or the Sesson.Property isnt resetting the value in the runtime.
When I run the script myself (with the comments removed), I see the expected output - so I know its parsing the INI properly... but the session.property doesnt work interactively, so I cant test that part.
There's probably something very simple I've overlooked. Appreciate your help.