Jump to content

INIRead()


GEOSoft
 Share

Recommended Posts

Do we still really need to have a default value set in this function.

I'm thinking that without it we could use things like

If INIRead($Ini,"section","Value") Then
   Do what I want
Else
   Do the alternative
EndIfoÝ÷ Ù(§qâ.²æ¥(Z½ëay×jém±ëm¡¦åjy,¶¸§©òÁ¬ßÙ­)äx-«kzÛ«)à©lz+^®ØZ·­º¹âay¹ZK-®)à"Ü(ÖÞmëmz»ajv®¶­sbb33cµfÂÒä&VBb33c´æÂgV÷C·6V7FöâÂgV÷CµfÇVRgV÷C²ÂgV÷C²gV÷C²¤bäõBb33cµfÂÒgV÷C²gV÷C²FVà¢FòvFWfW ¤VÇ6P¢Fò6öÖWFærVÇ6P¤VæD

I'd really like to read users opinions and reasoning.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

  • Developers

How would you distinct between the keyword not being in the INI file and the keyword being "" ?

FileWriteLine("test.ini","[Main]")
$test = INIRead("test.ini","Main", "test", "Not There")
If $test = "Not There" Then
   ConsoleWrite("Test not in ini" & @LF)
Else
   ConsoleWrite("Test value is " & $test & @LF)
EndIf
;   
FileWriteLine("test.ini","test=")
$test = INIRead("test.ini","Main", "test", "Not There")
If $test = "Not There" Then
   ConsoleWrite("Test not in ini" & @LF)
Else
   ConsoleWrite("Test value is " & $test & @LF)
EndIf

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

How would you distinct between the keyword not being in the INI file and the keyword being "" ?

FileWriteLine("test.ini","[Main]")
$test = INIRead("test.ini","Main", "test", "Not There")
If $test = "Not There" Then
   ConsoleWrite("Test not in ini" & @LF)
Else
   ConsoleWrite("Test value is " & $test & @LF)
EndIf
;   
FileWriteLine("test.ini","test=")
$test = INIRead("test.ini","Main", "test", "Not There")
If $test = "Not There" Then
   ConsoleWrite("Test not in ini" & @LF)
Else
   ConsoleWrite("Test value is " & $test & @LF)
EndIf
My thinking was by returning error codes. I'm not sure just how feasable this is but I've been thinking about it for a long time now so I thought I would post it to see the response.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I'd really like to read users opinions and reasoning.

With a default value, you do not need to use If...Then...EndIf to check as your code assumes that the value passed, whether default or as in the ini file is suitable to use. So your logic of it being the same as your 1st example is like comparing an apple to a banana. Enjoy healthy eating.

:)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...