gcue Posted June 6, 2008 Share Posted June 6, 2008 (edited) my gui builds out icons based on whats in an INI. if the INI is badly formatted, the app gets an error which isnt clear that the INI is the problem and the user isnt able to load the program. heres an example of a good INI: [LOCATIONS] TEST_LOCATION=TEST_LOCATION_ASSETS [TEST_LOCATION_ASSETS] INITIALS=D0000000 each location is listed under locations section along with a pointer to its PCs (assets) if theres a mismatch (misspelling or lack of) between location list and corresponding location_asset list then id like to inform the user hope im making sense.......... heres what i have so far (not working obviously): $LOCS=IniReadSectionNames($ini) $loc_assts=IniReadSection($ini, "Locations") For $LOC in $LOCS If $loc_assts<>$LOC Then $answer = MsgBox(16, "Dashboard", "Badly formatted assets.ini." & @CRLF & _ "Application will now exit.") Exit EndIf Next Edited June 6, 2008 by gcue Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 6, 2008 Share Posted June 6, 2008 my gui builds out icons based on whats in an INI. if the INI is badly formatted, the app gets an error which isnt clear that the INI is the problem and the user isnt able to load the program. heres an example of a good INI: [LOCATIONS] TEST_LOCATION=TEST_LOCATION_ASSETS [TEST_LOCATION_ASSETS] INITIALS=D0000000 each location is listed under locations section along with a pointer to its PCs (assets) if theres a mismatch (misspelling or lack of) between location list and corresponding location_asset list then id like to inform the user hope im making sense.......... heres what i have so far (not working obviously): $LOCS=IniReadSectionNames($ini) $loc_assts=IniReadSection($ini, "Locations") For $LOC in $LOCS If $loc_assts<>$LOC Then $answer = MsgBox(16, "Dashboard", "Badly formatted assets.ini." & @CRLF & _ "Application will now exit.") Exit EndIf Next You are treating $LOCS as an array, which is correct, but you are not treating $loc_assts as the 2D array that it is. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
martin Posted June 6, 2008 Share Posted June 6, 2008 my gui builds out icons based on whats in an INI. if the INI is badly formatted, the app gets an error which isnt clear that the INI is the problem and the user isnt able to load the program. heres an example of a good INI: [LOCATIONS] TEST_LOCATION=TEST_LOCATION_ASSETS [TEST_LOCATION_ASSETS] INITIALS=D0000000 each location is listed under locations section along with a pointer to its PCs (assets) if theres a mismatch (misspelling or lack of) between location list and corresponding location_asset list then id like to inform the user hope im making sense.......... heres what i have so far (not working obviously): $ini = "settings.ini" $LOCS = IniReadSection($ini,"LOCATIONS");read all the loactions If @error Or Not IsArray($LOCS) Then MsgBox(262144, "ERROR 20", "No data in ini file!") Exit EndIf For $n = 1 To $LOCS[0][0];for each location $temp = IniReadSection($ini, $LOCS[$n][1]);is there a section for the location? If @error Then MsgBox(262144, "Error 21 in ini file", "Section '" & $LOCS[$n][1] & "' is corrupt or missing.") If MsgBox(262144 + 4, "Choose option", "Do you want to remove references to " & $LOCS[$n][1] & "?") = 6 Then IniDelete($ini, "LOCATIONS", $LOCS[$n][0]) EndIf EndIf NextI think you need something like this. $LOCS = IniReadSection("LOCATIONS");read all the loactions If @error Or Not IsArray($LOCS) Then MsgBox(262144, "ERROR 20", "No data in ini file!") Exit EndIf For $n = 1 To $LOCS[0][0];for each location $temp = IniReadSection($ini, $LOCS[$n][1]);is there a section for the location? If @error Then MsgBox(262144, "Error 21 in ini file", "Section '" & $LOCS[$n][1] & "' is corrupt or missing.") If MsgBox(262144 + 4, "Choose option", "Do you want to remove references to " & $LOCS[$n][1] & "?") = 6 Then IniDelete($ini, "LOCATIONS", $LOCS[$n][0]) EndIf EndIf Next Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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