View Full Version : Get Ini Value......
08-25-2004, 10:09 PM
Trying to get a value from an ini file. I don't get any compile errors but I only ever get back the default value which suggests that its not finding the ini value. I've tried a number of variations in my entry fields. What is the exact syntax required.
08-26-2004, 12:31 AM
For example, to read the Clarion 6.x workdir out of the win.ini file, you can use the following:
Get INI Value function
INI Section: Clarion 6.0 Enterprise Edition
INI Item: workdir
The %TEST% variable holds the workdir value. If the call failed, it holds 0 (the Default value). In our latest source codes, the %ERRORCODE% variable is set to -1 if the call failed and 0 if it was successful.
Does this help?
08-26-2004, 03:39 AM
Correction: If the function succeeds, the %ERRORCODE% value is the number of characters copied to the buffer, not including the terminating null character.
It is not set to -1 if the function fails.
08-26-2004, 04:35 AM
Ok then, I think I was doing it correctly but not getting the results I expected.
My Test was:
Default: C:\Program Files\My New Directory
Pathname: E:\My Documents\My SetupBuilder 5 Projects\MyTest.ini
INI Section: [SetupBuilder] !Note SetupBuilder included the brackets, not me.
INI Item: InstallDir
I put a test message window after this with the text being %_SB_INSTALLDIR%
I compiled and ran a test, and both the test message and the "Destination Window" showed the default path when I knew that both the path and the ini file were correct. Can you see any reason why this would be failing? Any other test I should perform?
08-26-2004, 04:45 AM
Hmm, SB5 included the brackets? Could you please send your script (.sb5) to my private email?
08-26-2004, 05:29 PM
Hmm, SB5 included the brackets?
Your comment started me doubting myself. With good reason as it turns out. I removed the brackets and it worked. I created a new "Get Ini Value" script, and what do you know; NO BRACKETS!
I had seen the brackets and I knew I wasn't so stupid as to have included them :) so it was only logical that SetupBuilder had automatically put them there. Now I know it must have been my wife :o .
Sorry for annoying you.
08-28-2004, 03:31 AM
<BG> I am glad that its working fine! Thanks for the update.
vBulletin® v3.8.4, Copyright ©2000-2014, Jelsoft Enterprises Ltd.