TheCrimsonCrusader Posted December 15, 2015 Share Posted December 15, 2015 I am wanting to create a simple software installer with a cheesy animated progress bar and a progress bar marking progress for a simple software installer. Where I run into a problem is if I call the cheesy animated progress in a loop before the software installation calls, it will obviously be stuck in that loop and never actually run the rest of the code.If I put it after the installation calls, then it won't run until after those installation calls are complete. How do I have the cheesy animated progress continue to run until the last installation call is made? For convenience of script testing, I just replaced software installation calls to just running notepad instead so after you close out one notepad, the next one opens up and the percentage moves up.I'm sure it's something simple, but no clue on my part. Thanks for any assistance! expandcollapse popup#include <WindowsConstants.au3> Opt("TrayMenuMode", 3) ;this is necessary to have system tray icon shown without menu options and to allow system tray bubble tips Opt ("GUIOnEventMode", 1) Opt("GUIResizeMode", 1) Dim $SS_ETCHEDFRAME,$PBS_SMOOTH GUICreate("Software Installation", 400, 420,-1,-1,$WS_MINIMIZEBOX) GUICtrlCreateLabel("Progress:",1,225,100,20,$SS_ETCHEDFRAME,$WS_EX_DLGMODALFRAME) GUICtrlSetFont (-1,-1, 800) $progressbar = GUICtrlCreateProgress (100,225,25,20,BitOR($WS_EX_LAYERED,$PBS_SMOOTH)) $progressbarsteps = GUICtrlCreateProgress (162,225,231,20,BitOR($WS_EX_LAYERED,$PBS_SMOOTH)) $progresspercent = GUICtrlCreateLabel ("0%",125,225,37,20,$SS_ETCHEDFRAME,$WS_EX_DLGMODALFRAME) GUICtrlSetFont (-1,-1, 800) GUISetState() ;Cheesy animated progress While 1 Sleep(1000) GUICtrlSetData($progressbar, 0) GUICtrlSetData($progressbar, 100) Wend ;Install applications one after another $AppInstall1 = RunWait("notepad.exe") GUICtrlSetData($progressbarsteps, 25) GUICtrlSetData($progresspercent,"25%") $AppInstall2 = RunWait("notepad.exe") GUICtrlSetData($progressbarsteps, 50) GUICtrlSetData($progresspercent,"50%") $AppInstall3 = RunWait("notepad.exe") GUICtrlSetData($progressbarsteps, 75) GUICtrlSetData($progresspercent,"75%") $AppInstall4 = RunWait("notepad.exe") GUICtrlSetData($progressbarsteps, 100) GUICtrlSetData($progresspercent,"100%") Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 15, 2015 Moderators Share Posted December 15, 2015 @TheCrimsonCrusader what are you trying to install, and why would you not do a silent installation rather than a "cheesy animated progress bar"? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
JohnOne Posted December 15, 2015 Share Posted December 15, 2015 remove the while loop/ AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
TheCrimsonCrusader Posted December 15, 2015 Author Share Posted December 15, 2015 (edited) @TheCrimsonCrusader what are you trying to install, and why would you not do a silent installation rather than a "cheesy animated progress bar"?The install could be anything. When installing MSIs, I would be installing them unattended/silent (/qn switch) and installation executables, I would be running those unattended/silent as well. The purpose is just to have something animated, to show that the installation is in progress and that the machine or installation is not locked up. Edited December 15, 2015 by TheCrimsonCrusader Link to comment Share on other sites More sharing options...
TheCrimsonCrusader Posted December 15, 2015 Author Share Posted December 15, 2015 remove the while loop/Then the small progress bar will only run once and won't be animated. The intent is to have that go from 0% to 100% in a loop just to show that the operation is currently running and then the other progress is is the one that shows what actual percentage complete for all of the software installation steps. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 15, 2015 Moderators Share Posted December 15, 2015 It sounds like you want the progress bar up and going as long as the installation is still running. By your statement above, it is going to go from 0 to 100, then starting over, until the install completes. Won't that irritate your users? Why not just install with /qb switch so the progress bar actually matches the installation? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Bert Posted December 15, 2015 Share Posted December 15, 2015 Look at the volatran project. Link is in my signature The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
TheCrimsonCrusader Posted December 15, 2015 Author Share Posted December 15, 2015 (edited) It sounds like you want the progress bar up and going as long as the installation is still running. By your statement above, it is going to go from 0 to 100, then starting over, until the install completes. Won't that irritate your users? Why not just install with /qb switch so the progress bar actually matches the installation? I guess I am explaining it poorly. :-)So when the GUI is opened with the current code. It looks like this in terms of format:A label called "Progress" followed by the Animated progress ($progressbar variable) followed by the progress percentage ($progresspercent variable) followed by the actual progress bar ($progressbarsteps variable)The animated progress bar ($progressbar variable) is only 25x20 and just goes from 0% to 100% and back again in a loop. This is my poor man's version of that little animated circle in today's modern Windows OSs that used to be the hour glass. So it's small an unobtrusive.Then to the right of that is the actual progress percentage followed by the progress bar. All I am doing there is let's say there are 4 installs and I am doing them all silently, I am just doing application installation 1 and setting it to go to 25% after completion and then application installation 2 and setting that to 50% after completion and so on.I don't want to use the QB switch as I want to hide the native installation progress and just use the static mechanism above. It works, but I would like to have the animated progress bar that is just 25x20 going from 0% to 100% and back throughout the entire process until the last installation is complete. Edited December 15, 2015 by TheCrimsonCrusader Link to comment Share on other sites More sharing options...
JohnOne Posted December 15, 2015 Share Posted December 15, 2015 I don't get it, if each notepad represents an application installation, then removing the while loop does what you are describing. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
TheCrimsonCrusader Posted December 15, 2015 Author Share Posted December 15, 2015 I don't get it, if each notepad represents an application installation, then removing the while loop does what you are describing.If I remove the loop, those notepad call steps will run. So the first notepad is ran and when I close that, it goes to 25%. Then the next notepad is ran and when I close that, it goes to 50% and so on. That part works.However, by removing the loop, the small progress bar that goes from 0% back to 100% in a loop won't if I remove the loop obviously. The intent of this is to have something moving at all times to let a user know that it is currently in the process of installing applications since some applications might take a long time to install and I don't want to rely on external progress bars such as the /QB switch for MSI installations.Think of the small progress bar as just being a flashing text label instead that says "Installing..." That's basically what I am wanting to accomplish. Since I am having the main progress bar only increase in percentage after each install is done, I want something animated to make it look like it is doing something throughout the entire process.. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 15, 2015 Moderators Share Posted December 15, 2015 TheCrimsonCrusader,The intent of this is to have something moving at all times to let a user know that it is currently in the process of installingUse a marquee progress bar - that is why it exists:#include <GUIConstantsEx.au3> #include <ProgressConstants.au3> $hGUI = GUICreate("Test", 500, 500) GUICtrlCreateProgress(10, 10, 400, 20, $PBS_MARQUEE) GUICtrlSendMsg(-1, $PBM_SETMARQUEE, True, 50) ; final parameter is update time in ms GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndM23 TheCrimsonCrusader 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...
TheCrimsonCrusader Posted December 15, 2015 Author Share Posted December 15, 2015 Maybe another way to put it is I want something equivalent to this running while the installs are running:http://zanstra.home.xs4all.nl/picks/progress.htmlI just thought it an easier way would be to have a small progress bar running in a loop from 0% to 100% and back. Link to comment Share on other sites More sharing options...
JohnOne Posted December 15, 2015 Share Posted December 15, 2015 (edited) However, by removing the loop, the small progress bar that goes from 0% back to 100% in a loop won't if I remove the loop obviously.Then the updating of that bar should be done within the functions which really installs these applications. Edited December 15, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
JohnOne Posted December 15, 2015 Share Posted December 15, 2015 expandcollapse popup#include <WindowsConstants.au3> Opt("TrayMenuMode", 3) ;this is necessary to have system tray icon shown without menu options and to allow system tray bubble tips Opt("GUIOnEventMode", 1) Opt("GUIResizeMode", 1) Dim $SS_ETCHEDFRAME, $PBS_SMOOTH GUICreate("Software Installation", 400, 420, -1, -1, $WS_MINIMIZEBOX) GUICtrlCreateLabel("Progress:", 1, 225, 100, 20, $SS_ETCHEDFRAME, $WS_EX_DLGMODALFRAME) GUICtrlSetFont(-1, -1, 800) $progressbar = GUICtrlCreateProgress(100, 225, 25, 20, BitOR($WS_EX_LAYERED, $PBS_SMOOTH)) $progressbarsteps = GUICtrlCreateProgress(162, 225, 231, 20, BitOR($WS_EX_LAYERED, $PBS_SMOOTH)) $progresspercent = GUICtrlCreateLabel("0%", 125, 225, 37, 20, $SS_ETCHEDFRAME, $WS_EX_DLGMODALFRAME) GUICtrlSetFont(-1, -1, 800) GUISetState() ;Cheesy animated progress ;While 1 ; Sleep(1000) ; GUICtrlSetData($progressbar, 0) ; GUICtrlSetData($progressbar, 100) ;Wend ;Install applications one after another _Install() GUICtrlSetData($progressbarsteps, 25) GUICtrlSetData($progresspercent, "25%") _Install() GUICtrlSetData($progressbarsteps, 50) GUICtrlSetData($progresspercent, "50%") _Install() GUICtrlSetData($progressbarsteps, 75) GUICtrlSetData($progresspercent, "75%") _Install() GUICtrlSetData($progressbarsteps, 100) GUICtrlSetData($progresspercent, "100%") Func _Install() GUICtrlSetData($progressbar, 0) For $i = 1 To 100 GUICtrlSetData($progressbar, $i) Sleep(10) Next EndFunc ;==>_Install AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
TheCrimsonCrusader Posted December 15, 2015 Author Share Posted December 15, 2015 Thank you, Melba. That does the trick and is much easier. I appreciate everyone's help on this! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 15, 2015 Moderators Share Posted December 15, 2015 If all you want is a GIF animation like what you linked to, you can use Trancexx's GIFAnimation UDF:#include <Constants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <FontConstants.au3> #include <GIFAnimation.au3> $sFilePath = @ScriptDir & "\blue-kiwi-zen-big.gif" $hGUI = GUICreate("Please wait while we install your product", 250, 200,-1,-1,$WS_DLGFRAME) GUISetBkColor ($COLOR_WHITE) GUISetState(@SW_SHOW, $hGUI) Global $hGIF = _GUICtrlCreateGIF($sFilePath, "", 60, 15) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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