I am having a couple of problems with READPROFILESTRING: probably just not understanding how it is supposed to work...
Code:
Break Off
; This script adds the following lines to the Appsrv.ini file in the users profile
; SSOnUserSetting=On
; EnableSSOnThruICAFile=On
$appsrvini = "%USERPROFILE%\Application Data\ICAClient\appsrv.ini"
;Does File Exist?
IF EXIST ($appsrvini) = 1
;Does section [WFCLIENT] Exist?
$nul=READPROFILESTRING ($appsrvini, "WFClient", "")
IF @ERROR = 0 ;if Section exists
;Add/modify lines to [WFCLIENT] section
$nul=WriteProfileString($appsrvini,"WFClient","SSOnUserSetting","On")
$nul=WriteProfileString($appsrvini,"WFClient","EnableSSOnThruICAFile","On")
ELSE
? @ERROR
;WFClient section missing from appsrv.ini file.
?"WFClient section missing from appsrv.ini file."
ENDIF
ELSE
;appsrv.ini does not exist in the users profile
?"appsrv.ini does not exist in the users profile"
ENDIF
?"finished"
get $nul
I test the script and it works fine.
I remove the [WFclient] section to test the result and the READPROFILESTRING still returns a '0'. When I echo $nul at this point I find the string contains:
SSOnUserSetting
EnableSSOnThruICAFile
This explains why it is returning a '0' - but where on earth is it picking these entries up from. The section does not exist in the ini file.
any thoughts welcome...