Queener Posted July 28, 2016 Posted July 28, 2016 (edited) If a loop increment is For $i = 0 To 5 MsgBox(0, "", $i) Next Exit How do you write a loop decrements? Nevermind, I was using the wrong way. ;this is the correct way For $i = 5 To 1 Step -1 MsgBox(0, "", $i) Next Exit ;I was coding it this way: :) For $i = 1 To 5 Step -1 MsgBox(0, "", $i) Next Exit Edited July 28, 2016 by Queener Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
water Posted July 28, 2016 Posted July 28, 2016 The help file is your friend Set Step to a negative value. For <variable> = <start> To <stop> [Step <stepval>] My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Queener Posted July 28, 2016 Author Posted July 28, 2016 I created a list to show data from ini file. No matter how I pull the data (Incremently or Decremently), it always display the last data on top of the rows. Am I doing something wrong? Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
water Posted July 28, 2016 Posted July 28, 2016 Hard to tell without seeing your code My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Queener Posted July 28, 2016 Author Posted July 28, 2016 (edited) expandcollapse popupHotKeySet("{ESC}","_Exit") #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiButton.au3> #include <EditConstants.au3> #include <ListBoxConstants.au3> #include <ComboConstants.au3> #include <Array.au3> #include <GuiComboBox.au3> #include <string.au3> $title = "Perfect Tool" $load = GUICreate($title,278,351,-1,-1,-1,-1) $inputList = GUICtrlCreateCombo("",18,72,239,28,-1,-1) GUICtrlSetFont(-1,12,400,0,"MS Sans Serif") $LConfig = GUICtrlCreatelist("",18,122,239,175,-1,$WS_EX_CLIENTEDGE) $inputSearch = GUICtrlCreateInput("",18,24,159,29,-1,$WS_EX_CLIENTEDGE) GUICtrlSetFont(-1,12,400,0,"MS Sans Serif") $bSearch = GUICtrlCreateButton("Search",184,24,73,29,-1,-1) GUICtrlSetFont(-1,12,400,0,"MS Sans Serif") $bdel = GUICtrlCreateButton("Delete",18,308,100,30,-1,-1) GUICtrlSetFont(-1,12,400,0,"MS Sans Serif") $bload = GUICtrlCreateButton("Load",157,308,100,30,-1,-1) GUICtrlSetFont(-1,12,400,0,"MS Sans Serif") GUISetState(@SW_SHOW,$load) ;Ini Top Variables $iniLoc = @ScriptDir & "\config.ini" ;List the Section Names on Seach combobox $iniLoadSearchName = IniReadSectionNames($iniLoc) $listname = "" $listname2 = "" If Not @error Then For $i = 1 To $iniLoadSearchName[0] $listname &= $iniLoadSearchName[$i] & "|" Next $inistring = StringTrimRight($listname, 1) EndIf While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $bSearch GUICtrlSetData($inputlist, "") GUICtrlSetData($inputList,$inistring) Case $bdel reload() Case $bload Loader() EndSwitch WEnd Func Loader() $iIndex = 0 Do $iIndex += 1 $sCode = IniRead($iniLoc, "John", "Job" & $iIndex, "Error") Until $sCode = "Error" $iIndex = $iIndex - 1 For $n = $iIndex to 1 Step -1 GUICtrlSetData($LConfig, "Job"&$n & " = " & _ IniRead($iniLoc, GUICtrlRead($inputList), "Job"&$n, "") & " --- PayID"&$n & " = " & _ IniRead($iniLoc, GUICtrlRead($inputList), "PayID"&$n, "")) Next EndFunc Func Reload() ;reload the list correctly $inistring = StringReplace($inistring, "|" & GUICtrlRead($inputlist), "") ;ini delete time IniDelete($iniLoc, GUICtrlRead($inputlist)) ;clear the data GUICtrlSetData($inputlist, "") ;re-populate the list GUICtrlSetData($inputlist, $inistring) EndFunc Func _Check($sName = 1) ;Function to load list guictrlsetdata($InputSearch,'') guictrlsetdata($inputList,'') local $hit = false for $1 = 1 to $iniLoadSearchName[0] if stringregexp($iniLoadSearchName[$1],'(?i)\Q' & $sName & '\E') then guictrlsetdata($inputList,$iniLoadSearchName[$1]) $hit = True EndIf next if $hit Then _GUICtrlComboBox_SetCurSel ( $inputList , 0 ) ; set edit box to 1st in list ;guictrlsetdata($inputid,'ID = ' & inireadsection($inifile,guictrlread($inputsearch2))[1][1]) ; populate ID field EndIf Return EndFunc Func _Exit() Exit EndFunc [John] ID=1 Computer=HI0900 Desc=Cad Design Job1=Information Desk PayID1=11D Access1=HR Job2=Register Nurse PayID2=12D Access2=Building B Job3=Billing Code PayID3=13D Access3=Home Look at the Loader Func. Edited July 28, 2016 by Queener Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Queener Posted July 28, 2016 Author Posted July 28, 2016 (edited) I think I know why now. It's sorted by alphabet; thats why I'm seeing it other way around... I see... To solve my own issue: it's For $n = 1 To $iIndex GUICtrlSetData($LConfig, $n & " .Job"&$n & " = " & _ IniRead($iniLoc, GUICtrlRead($inputList), "Job"&$n, "") & " --- PayID"&$n & " = " & _ IniRead($iniLoc, GUICtrlRead($inputList), "PayID"&$n, "")) Next Edited July 28, 2016 by Queener Solved Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
water Posted July 28, 2016 Posted July 28, 2016 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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