soonyee91 Posted May 28, 2013 Share Posted May 28, 2013 Based on the help file, the example of the progress bar is progress with "sleep(1000)" which is 1 second. Any idea to create a progress bar for each of my file execution complete? Case $msg = $btn_action If $ordner <>0 then For $i In $ordner Local $oExcel = _ExcelBookOpen($i);open the excel File sleep (1000) _ExcelBookClose($oExcel) Next endif EndSelect WEnd Based on the above code structures, I will receive array of files stored in $ordner. It will keep on looping until there is no files. Any idea to create a progress bar which will be updated upon each file execution is complete? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 28, 2013 Moderators Share Posted May 28, 2013 soonyee91,As you know the number of files in the array, you can do this quite easily. I seem to remember that you like hints - so here we go: - Create your progress bar and then each time you start a new pass through the loop move the progress bar a suitable distance - the maths are here if you need to peek:$iInterval = Int(100 / UBound($aArray)) For $i = 1 To UBound($aArray) GUICtrlSetData($cProgress, $iInterval * $i) ; Do whatever you need to the array element Sleep(1000) ; This just to slow this example NextAll clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
soonyee91 Posted May 29, 2013 Author Share Posted May 29, 2013 Thanks for the great hint! However, I encounter a small problem. If I want to perform loop on each of my files then my progress bar cannot reach to the full due to this: "Ubound($ordner)-1" If I do not put minus one on the Ubound then the code will fail. Any idea to solve this issue? $iInterval = Int(100 / UBound($ordner)) For $i = 0 To UBound($ordner)-1 GUICtrlSetData($bar1, $iInterval*$i) ; Do whatever you need to the array element ;Sleep(1000) ; This just to slow this example Local $oExcel = _ExcelBookOpen($ordner[$i]);open the excel File sleep (1000) _ExcelBookClose($oExcel) Next Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted May 29, 2013 Moderators Solution Share Posted May 29, 2013 soonyee91, Just increase the counter value when calculating the progress bar value: GUICtrlSetData($bar1, $iInterval * ($i + 1)) Now you should get the bar filling. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
soonyee91 Posted May 29, 2013 Author Share Posted May 29, 2013 Thanks again for your quick reply! Do think of adding back one to the variable but don't know where to put it. You are really helpful! 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