jrgreenman Posted August 27, 2010 Report Share Posted August 27, 2010 I am setting a variable from a Section/Key in an ini file and am trying to detect if either the Section or the Key is missing from the file (as opposed to being present but containing a blank value). There are five "On Error" conditions in "Set Value from INI file", but none of them seem to be related to detecting missing Section/Key. Thoughts? Quote Link to comment Share on other sites More sharing options...
Cory Posted August 27, 2010 Report Share Posted August 27, 2010 Pretty simple. Create a test variable and set to the contents of the file. Then check if it contains the strings representing the sections an parameters. [b]Quasi code:[/b] Variable Set to ASCII Char 10 to %LF% Variable Set to ASCII Char 13 to %CR% Variable Set String %Section% to "[some Section]" Variable Set String %Parameter% to "%CR%%LF%Some Parameter=" Variable Set String %Test% to contents of c:\test.ini If Variable %Test% contains %Section% And If Variable %Test% contains %Parameter% Jump in the creek Else Give the user an error Endif CRLF (Carriage Return/Line Feed) is just there to make sure your parameter stars with end of line from the previous line. So in case you search for "Floyd=" and there is a parameter named "Pink Floyd=" Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.