Jump to content

Newbie Question - Progress?


Recommended Posts

I have created an AU3 script that automates a software installation; takes approximately 4 minutes for the installation to complete. When the script starts I have a splash screen describing the installation. I have this working without issue.

How would I include a progress bar to run on the screen? I found the ProgressOn Command, but not sure how to make it run while the software installs.

Any insight appreciated.

Thanks,

Kerry

Link to comment
Share on other sites

  • Moderators

kerrycorcoran,

If you are not worried about the exact timing, you can use a Marquee style progress bar like this:

#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <SendMessage.au3>

$hGUI = GUICreate("Test", 500, 500)

GUICtrlCreateProgress(10, 10, 200, 20, $PBS_MARQUEE)
_SendMessage(GUICtrlGetHandle(-1), $PBM_SETMARQUEE, True, 50)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

The final parameter of the message is the update speed in ms. You will, of course, have to make a small GUI to replicate the one provided by the Progress* functions because I do not believe that they support the Marquee style (sits back and waits to be proved wrong! :) ).

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks for the information guys!

I need to clarify, I found the Progress bar in the examples, and I figured out how to set the time. My Question is how to I have that Progress Bar display while my program is installed using my AU3 script. At this point the Progress Bar runs, then goes to the next step in my script which is installing the application. I want the Progress bar to start and want my program to install while the progress bar progresses. Make sense? Do I need to create a separate script in my inital script to call the progress bar and it runs seperately?

Link to comment
Share on other sites

Thanks for the information guys!

I need to clarify, I found the Progress bar in the examples, and I figured out how to set the time. My Question is how to I have that Progress Bar display while my program is installed using my AU3 script. At this point the Progress Bar runs, then goes to the next step in my script which is installing the application. I want the Progress bar to start and want my program to install while the progress bar progresses. Make sense? Do I need to create a separate script in my inital script to call the progress bar and it runs seperately?

So, what is your script doing while the application install is happening? During that time you should be updating the progress bar.

For example, if you kick of the install with a RunWait(), use just Run() instead and go into a loop that waits for the process to complete while updating the progress bar.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

So, what is your script doing while the application install is happening? During that time you should be updating the progress bar.

For example, if you kick of the install with a RunWait(), use just Run() instead and go into a loop that waits for the process to complete while updating the progress bar.

:)

That's what I'm trying to do, just not sure how to accomplish that. Here is a my testing script.

ProgressOn("Progress Meter", "Increments every second", "0 percent")

For $i = 10 to 100 step 10

sleep(500)

ProgressSet( $i, $i & " percent")

Next

ProgressSet(100 , "Done", "Complete")

Run ("notepad")

WinActive ("Untitled - Notepad")

Send ("This is a test")

Send ("{enter}")

sleep (1000)

Send ("This is a test")

Send ("{enter}")

sleep (1000)

Send ("This is a test")

Send ("{enter}")

sleep (1000)

Send ("This is a test")

Send ("{enter}")

sleep (1000)

Send ("This is a test")

Send ("{enter}")

sleep (1000)

sleep(500)

ProgressOff()

Can you show me how I'd have the Progress bar running while the script is running the test typing?

Link to comment
Share on other sites

You are completing the loop for the progress bar before you start the install. While the install is being done, nothing is updating the progress bar. You might want to just update the progress bar with an AdLib function instead.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You are completing the loop for the progress bar before you start the install. While the install is being done, nothing is updating the progress bar. You might want to just update the progress bar with an AdLib function instead.

;)

Again, Newbie here.. :) If you could elaborate that would help. I am just trying to have something that shows progress (based on a set time I configure in the script) while the scripted installation of the software completes.
Link to comment
Share on other sites

Again, Newbie here..  :) If you could elaborate that would help.  I am just trying to have something that shows progress (based on a set time I configure in the script) while the scripted installation of the software completes.

I've modified the script you posted to show you the basic method to use for updating a progress bar in that type of situation. 

ProgressOn("Progress Meter", "Increments every second", "0 percent")
sleep(500)
ProgressSet( 0, 0 & " percent")

Run ("notepad")
WinWaitActive("Untitled - Notepad")
Send ("This is a test")
Send ("{enter}")
ProgressSet( 20, 20 & " percent")
sleep (1000)

WinActivate ("Untitled - Notepad")
Send ("This is a test")
Send ("{enter}")
ProgressSet( 40, 40 & " percent")
sleep (1000)

WinActivate ("Untitled - Notepad")
Send ("This is a test")
Send ("{enter}")
ProgressSet( 60, 60 & " percent")
sleep (1000)

WinActivate ("Untitled - Notepad")
Send ("This is a test")
Send ("{enter}")
ProgressSet( 80, 80 & " percent")
sleep (1000)

WinActivate ("Untitled - Notepad")
Send ("This is a test")
Send ("{enter}")
ProgressSet( 100, 100 & " percent")
sleep (1000)

ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...