Sign in to follow this  
Followers 0
AlmarM

Realy Newb Question... Progressbar :$

9 posts in this topic

Can someone send a example of a progress bar ?? :">

I know it realys newb but i can't find anything in the Help file (Mayby im looking wrong) but I realy want one :)

And if someone wanne help me, can u please tell me how progressbar works ??


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hum, like this?

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")
sleep(500)
ProgressOff()

-edit-

Oh and I think this example tells you very clearly how it works :)

Edited by Nahuel

Share this post


Link to post
Share on other sites

Ty guys ^^

I'll say if i dont get something :)


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

... A few seconds later :)

Do you know how to one... That if you:

Start the script -> A progressbar will come at right bottom of your screen (above the time) -> The script I made will do what it needs to do -> and the progressbar will show how far the script is...


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites

I'm at work now and don't have Autoit here. Just an idea: (not sure if it'll work though :))

*Script starts*

$Timer=TimerInit()

$probar=GUICtrlCreateProgress (paramaters)

GUICtrlSetData ($probar1,TimerDiff($Timer))

.

.

.

*Script continues*

.

.

.

GUICtrlSetData ($probar,TimerDiff($Timer))

.

.

.

*Some more script*

.

.

.

GUICtrlSetData ($probar,TimerDiff($Timer))

Just an idea... But might work.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Here, I'm really bored:

ProgressOn("Progress", "Script meter", "0 percent",@DesktopWidth-300,@DesktopHeight-150)
;~ ==================
;~ 1/4 of your script goes here.
;~ ==================
Sleep(1000);this isn't necessary when the script is upthere, obviously.
ProgressSet( 25,"25 percent")
;~ ==================
;~ 1/4 of your script goes here.
;~ ==================
Sleep(1000);this isn't necessary when the script is upthere, obviously.
ProgressSet( 50,"50 percent")
;~ ==================
;~ 2/4 of your script goes here.
;~ ==================
Sleep(1000);this isn't necessary when the script is upthere, obviously.
ProgressSet( 75,"75 percent")
;~ ==================
;~ 3/4 of your script goes here.
;~ ==================
Sleep(1000);this isn't necessary when the script is upthere, obviously.
ProgressSet( 100,"100 percent","DONE!")
;~ ==================
;~ 4/4 of your script goes here.
;~ ==================
sleep(500)
ProgressOff()

I can't make it clearer than that, hehe.

Edited by Nahuel

Share this post


Link to post
Share on other sites

Once upon a time in a forum not far away, a young lad requested a progress bar example...and Lord WeaponX posted a response from upon high, asking in return only a small sacrifice of 100 lambs:

#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

Share this post


Link to post
Share on other sites

Another Thing to try if you just want a progress bar is this it will just show a windows progress bar but it works.

Func _FileCopy($fromFile,$tofile, $fc_flag=272)
    $winShell = ObjCreate("shell.application")
    $winShell.namespace($tofile).Copyhere($fromFile,$fc_flag)

_FileCopy("C:\program files\from.txt", "C:\program files\ToHere")oÝ÷ Ú«¨µéÚ

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