GEOSoft Posted April 29, 2007 Share Posted April 29, 2007 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Û^®Ø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 More sharing options...
Developers Jos Posted April 29, 2007 Developers Share Posted April 29, 2007 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 More sharing options...
GEOSoft Posted April 29, 2007 Author Share Posted April 29, 2007 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) EndIfMy 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 More sharing options...
Zedna Posted April 29, 2007 Share Posted April 29, 2007 IniRead is very often used function. So I think any "old scripts breaking" changes are not good with this "minimal benefit". Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Dickb Posted April 30, 2007 Share Posted April 30, 2007 What about doing it this way? If INIRead($Ini,"section","Value", False) Then Do what I want Else Do the alternative EndIf Link to comment Share on other sites More sharing options...
MHz Posted April 30, 2007 Share Posted April 30, 2007 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 More sharing options...
Valik Posted May 2, 2007 Share Posted May 2, 2007 And once again, this is a case of, if you don't like how something works, write a wrapper around it to do what you want. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now