gcue Posted June 3, 2008 Share Posted June 3, 2008 (edited) i know that INIReadsectionnames reads the ini sections and returns them to an arrayim trying to get userinput for a sectioname, but if it exists i want to prompt the user whether to delete it or not<not sure what line1 looks like so that it compares to every instance in the array> heres what i have:If Guictrlread($location)=(IniReadSectionNames($ini)) Then $answer = MsgBox(262148, "PC Finder", "Location already exists, overwrite?") If $answer = 6 Then IniDelete($ini, $location) ElseIf $answer = 7 Then IniWrite($ini, $location, "test_append", "appending") EndIf Else IniWrite($ini, $location, "test_add", "adding") EndIf Edited June 3, 2008 by gcue Link to comment Share on other sites More sharing options...
martin Posted June 3, 2008 Share Posted June 3, 2008 i know that INIReadsectionnames reads the ini sections and returns them to an array im trying to get userinput for a sectioname, but if it exists i want to prompt the user whether to delete it or not <not sure what line1 looks like so that it compares to every instance in the array> heres what i have:Maybe something like this $locs = IniReadSection($ini, "LOCATIONS");might already be done somewhere $match = 0 $selLoc = GUICtrlRead($location);read the location from the input or edit? For $i = 1 To $locs[0][0];see if $seLoc already in "LOCATIONS" section If $seLoc = $locs[$i][1] Then $match = $i ExitLoop EndIf Next If $match > 0 Then $answer = MsgBox(262148, "PC Finder", "Location already exists, overwrite?") If $answer = 6 Then IniDelete($ini, "LOCATIONS", $selLoc) $match = 0 ;not sure why delete it if you are going to write it again EndIf EndIf If $match = 0 Then IniWrite($ini, "LOCATIONS", $selLoc, $SelLoC & "_ASSETS") EndIf 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...
evilertoaster Posted June 3, 2008 Share Posted June 3, 2008 $array=IniReadSectionNames($ini) for $i=1 to $array[0] If Guictrlread($location)=$array[$i] Then $answer = MsgBox(262148, "PC Finder", "Location already exists, overwrite?") If $answer = 6 Then IniDelete($ini, $location) ElseIf $answer = 7 Then IniWrite($ini, $location, "test_append", "appending") EndIf Else Next IniWrite($ini, $location, "test_add", "adding") Link to comment Share on other sites More sharing options...
gcue Posted June 4, 2008 Author Share Posted June 4, 2008 (edited) running this through SciTE and i keep getting "missing endif statement" - cant see where or why?! Func Location_Check() $LOCS=IniReadSectionNames($ini) For $i=1 to $LOCS[0] If Guictrlread($location)=$LOCS[$i] Then $answer = MsgBox(262148, "PC Finder", "Location already exists, overwrite?") If $answer = 6 Then IniDelete($ini, $location) IniWrite($ini, $location, "test_replace", "replacing") ElseIf $answer = 7 Then IniWrite($ini, $location, "test_append", "appending") EndIf Else IniWrite($ini, $location, "test_add", "adding") Next EndIf ShellExecute($ini) EndFunc Edited June 4, 2008 by gcue Link to comment Share on other sites More sharing options...
gcue Posted June 4, 2008 Author Share Posted June 4, 2008 tried rebooting.. windows explorer had died previously.. so i thought maybe that was it.. ran it through scite - still same prob.. please tell me its not obvious.. the more i look at it the more frustrated i get Link to comment Share on other sites More sharing options...
k3v Posted June 4, 2008 Share Posted June 4, 2008 Looks like your final EndIf statement is outside your For Next loop... that would cause the "missing endif" error if the "If" begins inside the loop... they're overlapping. Link to comment Share on other sites More sharing options...
gcue Posted June 4, 2008 Author Share Posted June 4, 2008 duh!!! sorry man no sleep last night. 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