Archive: Question about pathing


Question about pathing
Ok, one more question then I'm good to go.

Can I store the path to an .INI file in a global variable since it's just a text string?

Example:

Section "Parse_Registry"
Var /GLOBAL machid
Var /GLOBAL configfile
; parse registry information to determine if MyProg is already installed
ReadRegStr $configfile HKLM "System\ControlSet001\Control\Session Manager\Environment" "EIDMS"
ReadRegStr $machid HKLM "System\ControlSet001\Control\Session Manager\Environment" "MACHID"
${If} $0 == ""
MessageBox MB_YESNOCANCEL "C:\MyProg has not been created. Would you like to create it now?"
${Else}
MessageBox MB_YESNOCANCEL "A existing installation of MyProg has been located. Read the existing settings for this workstation?"
ReadINIStr $0 "$configfile" "station$machid" "ViewServerId"

DetailPrint "$0"
${EndIf}

SectionEnd


Is this legal? Also, would it make more sense to store all the .INI settings in an array?

Of course you can. It's done all the time. See readRegStr example (among others) in http://nsis.sourceforge.net/Simple_tutorials


Thanks for the reply.

I created a global variable:

Var /GLOBAL g_ViewServerId


I then attempted to read the corresponding .INI file and place the VIEWServerID entry value into aforementioned global variable.

ReadINIStr $g_ViewServerId "$0" "station$machid" "ViewServerId"


But when I went to test if it returned a value using the DetailPrint function, the value was blank.

DetailPrint "$g_ViewServerID"


However, I did get a correct return value using registers instead of a global variable.

There is no difference between using the built in registers and custom ones.

Stu