LisHawj Posted May 9, 2016 Share Posted May 9, 2016 (edited) I am working with a piece of home grown software that does not have an installation status/notification and takes about 45-60 minutes to install (silent install without any visual cues). The only way I can tell when the software has completed installation is to search for its process name. I quickly wrote up the following script to give me a visual cue that the installation is ongoing ( a looping progress bar effect). Upon finding the process, the visual cue (progress bar complete and closes out). I am using Notepad.exe to test it. The codes get stuck and does not execute the codes below the While Loop. Your help is appreciated and thanks for your time. Status() Func Status() ProgressOn("Notepad Test", "Testing Progress Bar...", "") While 1 For $i = 0 To 100 Step 5 Sleep(1000) If Not ProcessExists("notepad.exe") Then ProgressSet($i) ElseIf ProcessExists("notepad.exe") Then ProgressSet(100, "", "Notepad.exe Exists!") Sleep(5000) ProgressOff() EndIf Next WEnd If ProcessExist($sHarvest_exe) Then ; more codes here ; more codes here ; more codes here ;End codes Call("stop") EndFunc ;==>Status Func Stop() MsgBox(0, "", "Testing completed!") Exit EndFunc ;==>Stop Edited May 9, 2016 by LisHawj Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 9, 2016 Moderators Share Posted May 9, 2016 LisHawj, You need to add an "ExitLoop 2" after closing the Progress, otherwise you just remain within the loops. M23 M23 LisHawj 1 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...
Skysnake Posted May 9, 2016 Share Posted May 9, 2016 @Melba23 quetion please? If one were to use code like this? Local $x =1 While $x = 1 ; --> While 1 ; do something ; If condition is met then $x = 0 ; --> exit the loop? Wend Is this good practice? Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 9, 2016 Moderators Share Posted May 9, 2016 Skysnake, I would say not. If there is one simple condition to be met then I would use a Do...Until loop: Local $x = 1 Do ; do something ; If condition is met then $x = 0 ; --> exit the loop? Until $x = 0 In the OP's case I would not use the built-in Progress* functions at all - I would simplify the whole thing by using a custom marquee progressbar along with a Do...Until loop: #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> Status() Func Status() $hGUI = GUICreate("Test", 500, 50) GUICtrlCreateProgress(10, 10, 480, 20, $PBS_MARQUEE) GUICtrlSendMsg(-1, $PBM_SETMARQUEE, True, 50) ; final parameter is update time in ms GUISetState() Do Sleep(1000) Until ProcessExists("notepad.exe") GUIDelete($hGUI) MsgBox(0, "", "Testing completed!") EndFunc ;==>Status The marquee progress is designed for events when the timing is uncertain - and "45-60 minutes" certainly falls into that category! M23 Skysnake 1 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...
Skysnake Posted May 9, 2016 Share Posted May 9, 2016 Brilliant. Thank you Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
LisHawj Posted May 9, 2016 Author Share Posted May 9, 2016 @Melba23, Thank you for your valued insights! I like your marquee suggestion and will incorporate that into my production script for the home grown software installer. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 9, 2016 Moderators Share Posted May 9, 2016 LisHawj, My pleasure, as always. 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...
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