Jump to content

progress bar that runs on its own


Recommended Posts

look .. most pple will call me a noob but i dont care ..we all haft to start somewere

what i need is a progress bar that will run on its own .. like a timer kinda thing.... so when the timer is on 34 seconds the progress bar will be 34% finished ... do you understand what i mean ?

and can anybody help me ?.. iv only been on it 3 days now:(

tnks

Budweiser + room = warm beerwarm beer + fridge = too long!warm beer + CO2 fire extinguisher = Perfect![quote]Protect the easly offended ... BAN EVERYTHING[/quote]^^ hmm works for me :D

Link to comment
Share on other sites

Merry X-Mas, bub.

#include <GUIConstants.au3>

GUICreate("Timer", 400, 100)  ; will create a dialog box that when displayed is centered
GUISetState (@SW_SHOW)       ; will display an empty dialog box

$PB = GUICtrlCreateProgress (10,10,340,20)
$LBLPERCENT = GUICtrlCreateLabel ( "0%", 360, 13, 30, 20 )

GUICtrlCreateLabel ( "Time (seconds)", 10, 43, 80, 20 )
$TIME = GUICtrlCreateInput ("100", 90, 40, 70, 20)

GUICtrlCreateLabel ( "Time remaining", 200, 43, 80, 20 )
$TIMEREMAIN = GUICtrlCreateInput ("100", 280, 40, 70, 20)

$BTNSTART = GUICtrlCreateButton ("Start",  160, 70, 80)

Func BEGIN()
    $STAMP = TimerInit ()
    
    Do 
        $DIFFERENCE = Int(TimerDiff ($STAMP) / 1000)
        $REMAIN = Int(GuiCtrlRead($TIME) - $DIFFERENCE)
        $PERCENT = Int( ($DIFFERENCE / GuiCtrlRead($TIME)) * 100)
        
        GuiCtrlSetData($TIMEREMAIN, $REMAIN)
        GuiCtrlSetData($PB, $PERCENT)
        GuiCtrlSetData($LBLPERCENT, $PERCENT & "%")
    Until $DIFFERENCE >= GuiCtrlRead($TIME)
EndFunc

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $BTNSTART
            BEGIN()
        EndSwitch
        
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend
Edited by weaponx
Link to comment
Share on other sites

Merry X-Mas, bub.

#include <GUIConstants.au3>

GUICreate("Timer", 400, 100)  ; will create a dialog box that when displayed is centered
GUISetState (@SW_SHOW)       ; will display an empty dialog box

$PB = GUICtrlCreateProgress (10,10,340,20)
$LBLPERCENT = GUICtrlCreateLabel ( "0%", 360, 13, 30, 20 )

GUICtrlCreateLabel ( "Time (seconds)", 10, 43, 80, 20 )
$TIME = GUICtrlCreateInput ("100", 90, 40, 70, 20)

GUICtrlCreateLabel ( "Time remaining", 200, 43, 80, 20 )
$TIMEREMAIN = GUICtrlCreateInput ("100", 280, 40, 70, 20)

$BTNSTART = GUICtrlCreateButton ("Start",  160, 70, 80)

Func BEGIN()
    $STAMP = TimerInit ()
    
    Do 
        $DIFFERENCE = Int(TimerDiff ($STAMP) / 1000)
        $REMAIN = Int(GuiCtrlRead($TIME) - $DIFFERENCE)
        $PERCENT = Int( ($DIFFERENCE / GuiCtrlRead($TIME)) * 100)
        
        GuiCtrlSetData($TIMEREMAIN, $REMAIN)
        GuiCtrlSetData($PB, $PERCENT)
        GuiCtrlSetData($LBLPERCENT, $PERCENT & "%")
    Until $DIFFERENCE >= GuiCtrlRead($TIME)
EndFunc

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $BTNSTART
            BEGIN()
        EndSwitch
        
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

wow :P.. its perfect

thank u ..

helped me alot :)

Budweiser + room = warm beerwarm beer + fridge = too long!warm beer + CO2 fire extinguisher = Perfect![quote]Protect the easly offended ... BAN EVERYTHING[/quote]^^ hmm works for me :D

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