Jump to content

Progressbar


Kivin
 Share

Recommended Posts

Custom copy progressbar to any Windows style

I just want to say thanks everybody in this forum, who try to help by answering in "general help and support forum".

Big big thank you!

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.2.0
 Author: Kivin
 Script Function: Custom copy progressbar to any Windows style
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <GUIConstants.au3>
GUICreate ("Demo Progress", 300,150)
$Label = GUICtrlCreateLabel ("0%",130,100,100,25)

$width = 200
$height = 50
$RGB = "FF"
$color = "0x00" & $RGB &"00"
$Bgcolor = 0xffffff
$Step = 2
$Mindata = 0
$Maxdata = 200
$left = 50
$top = 50
$currentdata = 0

$l=$left
$t=$top
$W=round ($Step/($Maxdata-$Mindata)*$width,0)
$h=$height

GUISetState (@SW_SHOW)
Progress ($left,$top,$width,$height,$color,$Bgcolor,$Step)
Func Progress ($left,$top,$width,$height,$color,$Bgcolor,$Step)
    GUICtrlCreateGraphic ( $left,$top,$width,$height)
    GUICtrlSetBkColor(-1,$Bgcolor)
    $temp4 = $RGB
While $Maxdata>$currentdata
    GUICtrlCreateGraphic ( $l,$t,$W, $h)
    $temp1= Dec ($temp4)
    $temp2=$temp1-2
    $temp3 = Hex ( $temp2)
    $temp4 = $temp3
    GUICtrlSetBkColor(-1,"0x" & $temp3)
    $currentdata = $currentdata + $Step
    $procent = $currentdata/$Maxdata*100
    
    $l=$l+$W
        
    Sleep ( 50 )
    GUICtrlSetData ($Label ,$procent & " %")
WEnd
msgbox (0,"Information","Copy has finished!")
EndFunc

do
    $msg = GUIGetMsg()    
until $msg = $GUI_EVENT_CLOSE

Script.au3

Link to comment
Share on other sites

This is demo script. Soon, I hope, I'll add color peak for progressbar. Also I want to make a wizard for making this progress.

Any comments?

Is it usefull?

Suggestions:

-Make an UDF and put functions to create and update the progress.

-Put start and end color as option.

Ed

Link to comment
Share on other sites

Looks nice, I like the gradient effect :whistle: In my mind, it'd be more useful if you could set the progress rather than it automatically going 0% to 100%. This could be done using the For..Next loop, it would look something like this:

For $i = 1 To 100
    Progress($i)
Next

It would put a real use to the progress bar..

Kurt

Awaiting Diablo III..

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