Sign in to follow this  
Followers 0
JamesNL

Indetermined Progress Bar

10 posts in this topic

I want to create an undetermined progress bar for the script I'm writing, because I don't know how long the process will take and I can't determine the current progress of the process.

Basically, an undetermined progress bar is a progress bar with a few blocks running from the left to the right (or vice-versa) of the bar, then going back again.

In Windows, you can find them when searching for files, or using a wizard that uses the web (webpublishing wizard, Passport-linking-wizard). You can also find them on Windows Update, when using the Custom mode. Or in Nero 7, when you insert a disc and Nero is analyzing it.

Back to the question: is this possible with AutoIt, using one of the functions or by loading a DLL?

Thanks in advance!

Share this post


Link to post
Share on other sites



I want to create an undetermined progress bar for the script I'm writing, because I don't know how long the process will take and I can't determine the current progress of the process.

Basically, an undetermined progress bar is a progress bar with a few blocks running from the left to the right (or vice-versa) of the bar, then going back again.

In Windows, you can find them when searching for files, or using a wizard that uses the web (webpublishing wizard, Passport-linking-wizard). You can also find them on Windows Update, when using the Custom mode. Or in Nero 7, when you insert a disc and Nero is analyzing it.

Back to the question: is this possible with AutoIt, using one of the functions or by loading a DLL?

Thanks in advance!

You can create your own in a GUI. For example, you can use GUICtrlCreateLabel and create a square or squares. Then you can keep moving the squares to different spots, making it seem as if they are moving.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I want to create an undetermined progress bar for the script I'm writing, because I don't know how long the process will take and I can't determine the current progress of the process.

Basically, an undetermined progress bar is a progress bar with a few blocks running from the left to the right (or vice-versa) of the bar, then going back again.

In Windows, you can find them when searching for files, or using a wizard that uses the web (webpublishing wizard, Passport-linking-wizard). You can also find them on Windows Update, when using the Custom mode. Or in Nero 7, when you insert a disc and Nero is analyzing it.

Back to the question: is this possible with AutoIt, using one of the functions or by loading a DLL?

Thanks in advance!

Let me just say that I'm very excited about figuring this one out on my own! What you are actually talking about is a marquee style progress bar. You have to set the control style to "PBS_MARQUEE", then send the "PBM_SETMARQUEE" message to the control.

You can find more info on this at MSDN.

Here is an example of working code:

#include <GUIConstants.au3>

Global Const $PBS_MARQUEE = 0x08
Global Const $WM_USER = 0x0400
Global Const $PBM_SETMARQUEE = ($WM_USER+10)

Global $status = 1

Opt("GUIOnEventMode", 1)

$GUI = GUICreate("Marquee Progress Bar", 200, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_CLOSE")

$GUI_Progress = GUICtrlCreateProgress(50, 25, 100, 20, $PBS_MARQUEE)
GUICtrlSendMsg($GUI_Progress, $PBM_SETMARQUEE, 1, 200)
$GUI_Button = GUICtrlCreateButton("Start/Stop", 70, 50)
GUICtrlSetOnEvent(-1, "Progress_Stop_Start")
GUISetState()

While 1 
    Sleep(100)
WEnd

Func Progress_Stop_Start()
    If $status Then
        GUICtrlSendMsg($GUI_Progress, $PBM_SETMARQUEE, 0, 200)
        $status = 0
    Else
        GUICtrlSendMsg($GUI_Progress, $PBM_SETMARQUEE, 1, 200)
        $status = 1
    EndIf
EndFunc

Func GUI_CLOSE()
    Exit
EndFunc
Edited by big_daddy

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Let me just say that I'm very excited about figuring this one out on my own! What you are actually talking about is a marquee style progress bar. You have to set the control style to "PBS_MARQUEE", then send the "PBM_SETMARQUEE" message to the control.

You can find more info on this at MSDN.

I am very excited you figured this one out on your own too. I had no idea this could be done so easily. Methinks I shall be playing with this in the near future.

Edit: See below...

You forgot to put in the function for GUI_CLOSE()

Func GUI_CLOSE()
   Exit
EndFunc

Edited by SerialKiller

Share this post


Link to post
Share on other sites

@SerialKiller - Thanks I didn't scroll all the way down when I copied.

@Zenda - It requires version 6 of Comctl32.dll which is included in Microsoft Windows XP or later.

Share this post


Link to post
Share on other sites

I created two UDF's for creating and controling these progress controls. You can find them here.

Share this post


Link to post
Share on other sites

Hey thanks, big_daddy, just what I was looking for :)

Share this post


Link to post
Share on other sites

Nice Job BD... Gary did one a while ago here also before we had GUICtrlSendMsg() I believe: http://www.autoitscript.com/forum/index.ph...indpost&p=77774


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
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
Sign in to follow this  
Followers 0