Jump to content

Indetermined Progress Bar


Recommended Posts

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!

Link to comment
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.
Link to comment
Share on other sites

  • Moderators

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Moderators

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

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.

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...