Jump to content
Sign in to follow this  

Progressbar error

Recommended Posts

Hi everyone!

There is a script:

#include <GUIConstants.au3>
#include <Misc.au3>
$CurrentWindow = GUICreate( "",250,100, -1,-1)
$ProgressBarStartPosition = 0
$ProgressBarStep = 0.1
$ProgressBarCurrentPosition = 0
$ProgressBarMaxPosition = 100

$CopyProgressbar = GUICtrlCreateProgress (10,15,200,20)
$CopyProgressbarPercentLabel = GUICtrlCreateLabel ("0 %", 10,40,200,20,$SS_CENTER)
$start = GUICtrlCreateButton ("Start",10,60,70,22)
GUISetState ( @SW_SHOW, $CurrentWindow )

Func Progress()
        For $ProgressBarCurrentPosition = 0 To $ProgressBarMaxPosition Step $ProgressBarStep
        Dim $ProgressBarCurrentPosition
        GUICtrlSetData ( $CopyProgressbar, $ProgressBarCurrentPosition )
        GUICtrlSetData ( $CopyProgressbarPercentLabel, $ProgressBarCurrentPosition & " %" )
        Sleep ( 100 )
    $msg = GUIGetMsg ( 1 )  
    Case $msg [0] = $start
Until $msg[0] = $GUI_EVENT_CLOSE

Main function is show progress.

When I push Start button, everything work fine.

But after $CopyProgressbarPercentLabel=>"6%" it began show 6.199999999% etc.

Where I mistaken?

I need only one nuber after point.

Also I want to know how to stop, pause, continue Func Progress()

Thanks for help!

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...