Jump to content

SuperNoob Question - Progress Bar


SMurphy
 Share

Recommended Posts

Hi all, please forgive the ignorance. I am pretty new to scripting in general, and extremely new to AutoIT.

I am currently trying to create a form with a progress bar. I used KODA and created the form and all looks pretty good. Of course when I run the script, the progress bar does nothing. So, I would like it to loop forever. It really is no indication of progress, rather something for the user to stare at before I shutdown and reboot their machine. Also, I would like the form to stay on top and not be able to be closed and/or minimized.

Help!

Thanks in advance..

Link to comment
Share on other sites

Thanks for the quick response... Unfortunately, I don't think you really understand how stoopid I really am when it comes to this...

Check out this code and let me know exactly where that needs to go...

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Program Files\AutoIt3\SciTE\Koda\Forms\Migrationprogress.kxf
$Form1 = GUICreate("Active Directory Migration", 553, 425, 228, 123)
GUISetIcon("C:\Program Files\AutoIt3\Icons\Exclaimation.ico")
$Progress1 = GUICtrlCreateProgress(32, 288, 481, 41)
GUICtrlSetData(-1, 5)
$Label1 = GUICtrlCreateLabel("Active Directory Migration in Progress", 72, 120, 408, 30)
GUICtrlSetFont(-1, 18, 800, 0, "Times New Roman")
GUICtrlSetColor(-1, 0x0A246A)
$clientlogo = GUICtrlCreatePic("C:\MigrationFiles\clientLogo.gif", 8, 8, 136, 90, BitOR($SS_NOTIFY,$WS_GROUP))
$ensynchLogo = GUICtrlCreatePic("C:\MigrationFiles\consultantLogo.gif", 408, 344, 133, 67, BitOR($SS_NOTIFY,$WS_GROUP))
$Label3 = GUICtrlCreateLabel("Please be patient while your computer is being migrated.", 72, 160, 303, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label4 = GUICtrlCreateLabel("This process typically completes in less than 5 minutes.", 72, 184, 300, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label5 = GUICtrlCreateLabel("However, it may take as long as 20 minutes.", 72, 208, 235, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label6 = GUICtrlCreateLabel("When the process completes your computer will restart.", 72, 232, 301, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label7 = GUICtrlCreateLabel("If you have questions or problems, please contact the helpdesk.", 32, 360, 344, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label2 = GUICtrlCreateLabel("WARNING", 208, 24, 144, 35)
GUICtrlSetFont(-1, 20, 800, 4, "Lucida Bright")
GUICtrlSetColor(-1, 0xFF0000)
$Icon2 = GUICtrlCreateIcon("C:\Program Files\AutoIt3\Icons\Stop.ico", 0, 168, 24, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
$Label8 = GUICtrlCreateLabel("DO NOT CLOSE THIS WINDOW", 208, 64, 332, 28)
GUICtrlSetFont(-1, 16, 800, 0, "Lucida Bright")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
Link to comment
Share on other sites

#include <GUIConstants.au3>

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
ProgressOn("Progress Meter", "Increments quickly", "0 percent")
For $i = 0 to 100
    ProgressSet( $i, $i & " percent")
    Sleep(10)
Next
For $i = 100 to 0 Step - 1
    ProgressSet( $i, $i & " percent")
    Sleep(10)
Next
WEnd

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Link to comment
Share on other sites

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Program Files\AutoIt3\SciTE\Koda\Forms\Migrationprogress.kxf
$Form1 = GUICreate("Active Directory Migration", 553, 425, 228, 123)
GUISetIcon("C:\Program Files\AutoIt3\Icons\Exclaimation.ico")
$Progress1 = GUICtrlCreateProgress(32, 288, 481, 41)
GUICtrlSetData(-1, 5)
$Label1 = GUICtrlCreateLabel("Active Directory Migration in Progress", 72, 120, 408, 30)
GUICtrlSetFont(-1, 18, 800, 0, "Times New Roman")
GUICtrlSetColor(-1, 0x0A246A)
$clientlogo = GUICtrlCreatePic("C:\MigrationFiles\clientLogo.gif", 8, 8, 136, 90, BitOR($SS_NOTIFY,$WS_GROUP))
$ensynchLogo = GUICtrlCreatePic("C:\MigrationFiles\consultantLogo.gif", 408, 344, 133, 67, BitOR($SS_NOTIFY,$WS_GROUP))
$Label3 = GUICtrlCreateLabel("Please be patient while your computer is being migrated.", 72, 160, 303, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label4 = GUICtrlCreateLabel("This process typically completes in less than 5 minutes.", 72, 184, 300, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label5 = GUICtrlCreateLabel("However, it may take as long as 20 minutes.", 72, 208, 235, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label6 = GUICtrlCreateLabel("When the process completes your computer will restart.", 72, 232, 301, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label7 = GUICtrlCreateLabel("If you have questions or problems, please contact the helpdesk.", 32, 360, 344, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label2 = GUICtrlCreateLabel("WARNING", 208, 24, 144, 35)
GUICtrlSetFont(-1, 20, 800, 4, "Lucida Bright")
GUICtrlSetColor(-1, 0xFF0000)
$Icon2 = GUICtrlCreateIcon("C:\Program Files\AutoIt3\Icons\Stop.ico", 0, 168, 24, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
$Label8 = GUICtrlCreateLabel("DO NOT CLOSE THIS WINDOW", 208, 64, 332, 28)
GUICtrlSetFont(-1, 16, 800, 0, "Lucida Bright")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
    For $i = 0 to 100
    GUICtrlSetData($Progress1, $i)
    Sleep(10)
   Next
   For $i = 100 to 0 Step - 1
    GUICtrlSetData($Progress1, $i)
    Sleep(10)
   Next
WEnd

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Link to comment
Share on other sites

okay.. I have another question regarding this subject...

Not all that important, but what if you wanted the progress status to move sort of like the Windows startup screen...

for example, your range is 0 to 100, but you want the progress bar 15 long and step by 5, but for every step it would remove 5 from the other side.. make sense?

picture this...

****______________________________

then

_****_____________________________

then

__****____________________________

then

___****___________________________

then

____****__________________________ etc...

again, not that important, but I thought maybe a good teaser anyway.

Link to comment
Share on other sites

I was thinking about something like that, but I have no clue how to accomplish it.

While this probably isn't the best way in the world to do this, here's a method to get a 'bouncing' progressbar. It flickers a little, but it updates for every number, too.

#include <GUIConstants.au3>

$Form1 = GUICreate("AForm1", 362, 145, 193, 115)
$Graphic1 = GUICtrlCreateGraphic(8, 24, 350, 20)
GUICtrlSetColor(-1, 0x3A6EA5)
GUICtrlSetBkColor(-1, 0xFFFBF0)
$Graphic2 = GUICtrlCreateGraphic(8, 25, 25, 18)
GUICtrlSetColor(-1, 0xA6CAF0)
GUICtrlSetBkColor(-1, 0xA6CAF0)
GUISetState(@SW_SHOW)

Global $i = 8
Global $godown = 0
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
    GUICtrlSetPos($Graphic2, $i, 25)
    if $i == 335 or $godown == 1 Then
        $i = $i - 1
        if $i = 8 Then
            $godown = 0
        Else
            $godown = 1
        EndIf
    Elseif $i >= 8 Then
        $i = $i + 1
        $godown = 0
    Else
        $i = $i + 1
    EndIf
WEnd
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...