microbious Posted June 19, 2009 Share Posted June 19, 2009 How can i skip sections with given section name s ? Right now i am detecting Level=< or > specified value but some sections should not be detected/removed so i need to skip them. Those sections do not have Key Level= but still removed for some reason. for $X = 1 to $Section[0] $level = IniRead ($filename,$Section[$X],'Level','Return Error. Nothing found in specified range') If $level >= Number ($MinValue) and $level <= Number ($MaxValue) Then $removed = IniDelete ($filename,$Section[$X]) Endif Please help Link to comment Share on other sites More sharing options...
ResNullius Posted June 19, 2009 Share Posted June 19, 2009 Can you post a sample INI file, and point out what sections are being deleted that shouldn't be? Link to comment Share on other sites More sharing options...
microbious Posted June 19, 2009 Author Share Posted June 19, 2009 YEs here please: $MinValue = GUICtrlRead ($Min);reads number from input $MaxValue = GUICtrlRead ($Max);reads number from input for $X = 1 to $Section[0];not sure what that does but it works $level = IniRead ($filename,$Section[$X],'Level','Return Error. Nothing found in specified range');Looking for Level which is in specified range If $level >= Number ($MinValue) and $level <= Number ($MaxValue) Then;if found level is more then min and less then max then remove section $removed = IniDelete ($filename,$Section[$X]);remove section which had level in range Endif Problem is that there are 2 or 3 other sections that have no such thing as Level= so they are being removed i am not sure why. I need to add something that would say If section does not have key Level= then its a bad section and move to next one Thanks Link to comment Share on other sites More sharing options...
microbious Posted June 19, 2009 Author Share Posted June 19, 2009 Hey man i think i found the answer but i dont understand why it works, can u explain ? $MinValue = GUICtrlRead ($Min) $MaxValue = GUICtrlRead ($Max) for $X = 1 to $Section[0] $level = IniRead ($filename,$Section[$X],'Level','Return Error. Nothing found in specified range') $badsection = IniRead ($filename,$Section[$X],"Level",'') If $badsection = @error Then SoundPlay (@TempDir & '/searching.mp3') ElseIf $level >= Number ($MinValue) and $level <= Number ($MaxValue) Then $removed = IniDelete ($filename,$Section[$X]) Endif All i did was added $badsection = IniRead ($filename,$Section[$X],"Level",'') If $badsection = @error Then SoundPlay (@TempDir & '/searching.mp3') But not sure why does it jump over those sections that dont have Level= Key in them Confused lol Link to comment Share on other sites More sharing options...
MrCreatoR Posted June 19, 2009 Share Posted June 19, 2009 You should check the return value from IniRead: $badsection = IniRead ($filename,$Section[$X],"Level",'error') If $badsection <> "error" And $level >= Number($MinValue) And $level <= Number($MaxValue) Then IniDelete ($filename,$Section[$X]) Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
microbious Posted June 19, 2009 Author Share Posted June 19, 2009 YEs i did look at that, says it returns 2 dimensional blah blah i dont understand that yet So i did what i did ad it works i dont know why but what the hell lol Link to comment Share on other sites More sharing options...
MrCreatoR Posted June 19, 2009 Share Posted June 19, 2009 YEs i did look at that, says it returns 2 dimensional blah blah i dont understand that yet It's not for IniRead or IniReadSectionNames, it's probably for IniReadSection.So i did what i did ad it works i dont know why but what the hell lolWell, you just check if IniRead return @error, but @error in this case will equel 0, so it's equivalent to empty string (""). It's the same as checking the default value, that's for the Default parameter in IniRead() is there. Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
microbious Posted June 19, 2009 Author Share Posted June 19, 2009 Thanks guys i will be looking at it.Program is released already so i guess i will be working in its features if any will be requested.Program was posted herehttp://www.adrenalineparty.com/UT2004tools.shtmlIts called Clean RPG meant to clean Unreal tournament 2004 RPG users database file withing specified range and remove Bot's and remove empty lines left behind. Link to comment Share on other sites More sharing options...
ResNullius Posted June 22, 2009 Share Posted June 22, 2009 Thanks guys i will be looking at it.Program is released already so i guess i will be working in its features if any will be requested.Program was posted herehttp://www.adrenalineparty.com/UT2004tools.shtmlIts called Clean RPG meant to clean Unreal tournament 2004 RPG users database file withing specified range and remove Bot's and remove empty lines left behind.Did you see my reply to your other post? http://www.autoitscript.com/forum/index.ph...st&p=697594 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