Jump to content

GUICtrlCreateProgress.


Recommended Posts

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.

Link to comment
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?

Link to comment
Share on other sites

  • Moderators

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.

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.

Link to comment
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

Edited by Somniis
Link to comment
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- #
Link to comment
Share on other sites

  • Moderators

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.

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.

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