Sign in to follow this  
Followers 0
AzKay

GUICtrlCreateProgress.

11 posts in this topic

Would anyone half an example for this? Like, the progress going up for whatever its downloading?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites



What's so difficult about it that you need an example to understand? Setting the value of a progress bar is basic math: Take however many units you've completed so far, divide it by the total number of units that you're working on, multiply by 100 and round it off. It's always the same calculations no matter what you're tracking the progress of. The help file has an example under GUICtrlCreateProgress, and an example of downloading a file in the background (thus allowing you to check its progress) can be found under InetGet.

Share this post


Link to post
Share on other sites

I suck at maths, What you just said, confused me.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

The calculation is this: GUICtrlSetData($progressbar, Round(($X/$Y)*100))

Where $X is the number of "things" (lines, files, bytes, or whatever) that you've finished so far, and $Y is the total number of "things" that you're doing. Make sense?

Share this post


Link to post
Share on other sites

Kinda. But still confused


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Kinda. But still confused

Confused? I thought sokko explained it wonderfully.
Local $ItemsFinished = 0, $TotalItemsToDo = 30, $CompletionPercentage = 100

For $iCountDown = $ItemsFinished To $TotalItemsToDo
    ToolTip('You are Currently ' & Int(($iCountDown / $TotalItemsToDo) * $CompletionPercentage) & '% Done.' _
            & @CR & 'Current Items Finished are: ' & $iCountDown, 0, 0)
    Sleep(500)
Next
No pecentage bar example of what's going on basically.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

$size = InetGetSize("file")
$kb = Round($size / 1024)

ProgressOn("Downloading...", "Retrieving new version.")
    While @InetGetActive
        $p = (100 * @InetGetBytesRead) / $size
        $kbi = Round(@InetGetBytesRead / 1024)
        ProgressSet($p, $kbi & "/" & $kb & " kilobytes", "Download in progress.")
        Sleep(130)
    WEnd
ProgressOff()

Example of downloading a file. :D

Edited by Somniis

Share this post


Link to post
Share on other sites

$size = InetGetSize("file")
$kb = Round($size / 1024)

ProgressOn("Downloading...", "Retrieving new version.")
    While @InetGetActive
        $p = (100 * @InetGetBytesRead) / $size
        $kbi = Round(@InetGetBytesRead / 1024)
        ProgressSet($p, $kbi & "/" & $kb & " kilobytes", "Download in progress.")
        Sleep(130)
    WEnd
ProgressOff()

Example of downloading a file. :D

Needed an example, using GUICtrlCreateProgress

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Needed an example, using GUICtrlCreateProgress

What's wrong with the example in the help file?

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

It confuses me.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

It confuses me.

Why don't you post what about it confuses you step by step, so you an be unconfused. You said in another thread, that the PixelSearch() confused you too, if the help file is confusing you, maybe it's confusing others too, and maybe it should be put in more lamens terms if it isn't already.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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