Ghost21 Posted July 8, 2008 Share Posted July 8, 2008 I have a progress bar eg. $Progressbar = GUICtrlCreateProgress(7, 72, 432, 12) <-----------------------------------------------------------------------------------------> Say 100 points long Now what is happening when I use the progress bar its filling the bar past what I can see for example it finds new records and goes to 177 but I can only see to 100. I would like it to load the 177 so it ends at the 100 point.. Hopefully that makes sense to someone muttley I don't want to change the display SIZE of the bar. Thanks Link to comment Share on other sites More sharing options...
Airwolf Posted July 8, 2008 Share Posted July 8, 2008 I have a progress bar eg.$Progressbar = GUICtrlCreateProgress(7, 72, 432, 12)<-----------------------------------------------------------------------------------------> Say 100 points longNow what is happening when I use the progress bar its filling the bar past what I can see for example it finds new records and goes to 177 but I can only see to 100. I would like it to load the 177 so it ends at the 100 point..Hopefully that makes sense to someone muttley I don't want to change the display SIZE of the bar.ThanksTo find the percentage of each increment, just divide 100 (which is the total length of the progress bar) by the total (177 records). Then after each record is processed, add 100/177 to the current progress. Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
Ghost21 Posted July 8, 2008 Author Share Posted July 8, 2008 To find the percentage of each increment, just divide 100 (which is the total length of the progress bar) by the total (177 records). Then after each record is processed, add 100/177 to the current progress.Falls over shaking... Umm This is what I have$Progressbar = GUICtrlCreateProgress(7, 72, 432, 12)For $iIndex = 1 To $oRS.RecordCount GUICtrlSetData($Progressbar, $iIndex)$oRS.MoveNextNextWhere abouts to I include that calculation.. ? Link to comment Share on other sites More sharing options...
Airwolf Posted July 8, 2008 Share Posted July 8, 2008 (edited) Falls over shaking... Umm This is what I have $Progressbar = GUICtrlCreateProgress(7, 72, 432, 12) For $iIndex = 1 To $oRS.RecordCount GUICtrlSetData($Progressbar, $iIndex) $oRS.MoveNext Next Where abouts to I include that calculation.. ?$Progressbar = GUICtrlCreateProgress(7, 72, 432, 12) $progress = 0 For $iIndex = 1 To $oRS.RecordCount GUICtrlSetData($Progressbar, $progress) $progress += 100/$oRS.RecordCount $oRS.MoveNext Next Edited July 8, 2008 by Airwolf Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
Ghost21 Posted July 8, 2008 Author Share Posted July 8, 2008 $Progressbar = GUICtrlCreateProgress(7, 72, 432, 12) $progress = 0 For $iIndex = 1 To $oRS.RecordCount GUICtrlSetData($Progressbar, $progress) $progress += 100/177 $oRS.MoveNext Next Why is the $progress += 100/177 after it sets it ??? Link to comment Share on other sites More sharing options...
Airwolf Posted July 8, 2008 Share Posted July 8, 2008 Why is the $progress += 100/177 after it sets it ???To add another 100/177 to the $progress variable so that the next time the For loop kicks off and the progress bar is updated, it will display the proper percentage. Without the $progress += 100/177 line, the progress bar would be updated to 0% every time. Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt Link to comment Share on other sites More sharing options...
Ghost21 Posted July 8, 2008 Author Share Posted July 8, 2008 To add another 100/177 to the $progress variable so that the next time the For loop kicks off and the progress bar is updated, it will display the proper percentage. Without the $progress += 100/177 line, the progress bar would be updated to 0% every time.Ahhh.. Man that makes way more sense.. Thanks for the GREAT HELP...P.S. IT worked perfect... Link to comment Share on other sites More sharing options...
aslani Posted July 8, 2008 Share Posted July 8, 2008 (edited) Just for reference, here's what I did on mine. expandcollapse popupFunc _cList() WinActivate($title) Dim $aList[1][5] $i_path_1 = FileOpenDialog("Load Forms", @DesktopDir & "\", "MS Excel Files (*.xl*;*.xls)", 4) $i_path_2 = FileOpenDialog("Create List or Add to a List", @DesktopDir & "\", "MS Excel Files (*.xl*;*.xls)") $aFiles = StringSplit($i_path_1, '|') ;_ArrayDisplay ($aFiles, "$aFiles") ; for debug $mousePos = MouseGetPos() _MouseTrap($mousePos[0], $mousePos[1], $mousePos[0], $mousePos[1]) $prog_gui = GuiCreate("Please wait", 500, 70, -1, $guiloc_y-100) $prog_bar1 = GUICtrlCreateProgress ($offset_1, 5, 475, 10, $PBS_SMOOTH) $prog_bar2 = GUICtrlCreateProgress ($offset_1, 20, 475, 10, $PBS_SMOOTH) $prog_label = GUICtrlCreateLabel ("", $offset_1, 35, 475, 25) GUISetState (@SW_SHOW, $prog_gui) $prog_perc1 = 0 $prog_perc2 = 0 For $ia = 0 To Ubound($aFiles) - 3 $cOrig = 26 ;26 or 28 GUICtrlSetData ($prog_label, "Reading..." & @CRLF & $aFiles[1] & "\" & $aFiles[$ia+2]) $aList[$ia][0] = _ExcelReadCell($rExcel, "C5") ; description $aList[$ia][1] = _ExcelReadCell($rExcel, "C7") ; manufacturer $aList[$ia][2] = _ExcelReadCell($rExcel, "C9") ; mfg partnumber $aList[$ia][3] = _ExcelReadCell($rExcel, "C" & $cOrig) ; originator name $ord = _ExcelReadCell($rExcel, "P" & $cOrig) ; originator date _ExcelBookClose($rExcel) $ord = StringLeft(String($ord), 8) $ordm = StringRight(StringLeft($ord, 6), 2) $ordd = StringRight($ord, 2) $ordy = StringLeft($ord, 4) $aList[$ia][4] = $ordm & "/" & $ordd & "/" & $ordy ReDim $aList[UBound($aList) + 1][Ubound($aList, 2)] $prog_perc1 += 100 / (Ubound($aFiles) - 3) GUICtrlSetData ($prog_bar1, $prog_perc1) Next For $ib = 0 To UBound($aList) - 1 $cl = 2 GUICtrlSetData ($prog_label, "Writing..." & @CRLF & $i_path_2) Local $oExcel = _ExcelBookOpen($i_path_2, 0) While _ExcelReadCell($oExcel, "B" & $cl) <> "" $cl = $cl+1 WEnd _ExcelWriteCell($oExcel, $aList[$ib][0], "B" & $cl) ; description _ExcelWriteCell($oExcel, $aList[$ib][1], "C" & $cl) ; manufacturer _ExcelWriteCell($oExcel, $aList[$ib][2], "D" & $cl) ; mfg partnumber _ExcelWriteCell($oExcel, $aList[$ib][3], "J" & $cl) ; originator name _ExcelWriteCell($oExcel, $aList[$ib][4], "K" & $cl) ; originator date _ExcelBookClose($oExcel) $prog_perc2 += 100 / Ubound($aList) GUICtrlSetData ($prog_bar2, $prog_perc2) Next _MouseTrap() MsgBox(0, "Done.", "Task is complete.") GUISetState (@SW_HIDE, $prog_gui) EndFunc Edited July 8, 2008 by aslani [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version Link to comment Share on other sites More sharing options...
BrettF Posted July 9, 2008 Share Posted July 9, 2008 FYI, the easiest way to generate a percentage is as follows: (Given amount/ Total amount)*100 Cheers, Brett muttley Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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