PDA

View Full Version : Get Ini Value......



gspillane
08-25-2004, 10:09 PM
Hi All,

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.

Best Regards,
Geoff Spillane

linder
08-26-2004, 12:31 AM
Hi Geoff,

For example, to read the Clarion 6.x workdir out of the win.ini file, you can use the following:

Get INI Value function
Variable: %TEST%
Default: 0
Pathname: %WINDIR%\win.ini
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?

Thanks,

linder
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.

gspillane
08-26-2004, 04:35 AM
Hi Friedrich,

Ok then, I think I was doing it correctly but not getting the results I expected.

My Test was:
Variable: %_SB_INSTALLDIR%
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?

Best Regards,
Geoff Spillane

linder
08-26-2004, 04:45 AM
Hi Geoff,

Hmm, SB5 included the brackets? Could you please send your script (.sb5) to my private email?

Thanks,

gspillane
08-26-2004, 05:29 PM
Hi Friedrich,


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.

Best Regards,
Geoff Spillane

linder
08-28-2004, 03:31 AM
Hi Geoff,

<BG> I am glad that its working fine! Thanks for the update.