Jump to content

Recommended Posts

Posted (edited)

Ok first here's is a part of my script where I want it to put the progress bar

$I = GUIRead($INPUT_2)
         For $P = 1 To $I
            $R = GUIRead($INPUT_1)
            ClipPut($R)
            Send("^v")
            Sleep(2000)
            Send("{ENTER}")
         Next

the $I is a number in the gui, lets say for this lets put it to 100. I want this to show a progress bar depending on the status of the loop. Like when the loop is at 78, well it display the progress bar at 78%. How I do this :D and where I put it in my code. Tx

Edited by galpha
Posted

If you are talking about a progress bar window, then see ProgressSet example in the help file.

I guess you mean an actual gui progress control, so try something like this:

$myProgressControl = GUISetControl ("progress", "Title", 10, 10)
;.....
$i = GuiRead($INPUT_2)
For $P = 1 to $I
  $percentageValue = $i ;scale it to be between 0 and 100
  GUISetControlEx($myProgressControl, $percentageValue)
;......

See GUISetControlEx in the help file for more info

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted

Well this won't work because lets say I enter the loop to do it like 10 times, the progress bar will stop at 9% but what I want it to do is that it follow the loop status, like lets say the loop is halfway done, the progress bar would then be at50%. I know how to do a GUIsetcontrolEX , just that I'm confused with this. Any methods on how to do it ?

Posted

Assuming the for loop it like this: For $P = $low to $high

Use a forumla like this to scale the result

$percentage = 100 * ($P - $low + 1) / ($high - $low + 1)

Assuming that $low < $high and both are positive integers

Here's an example usingProgressOn; you should be able to adapt it to GuiSetControlEx :D

ProgressOn("Progress Meter", "Increments every second", "0 percent")
$low = 2
$high = 4 
For $i = $low to $high
    sleep(1000)
    $percentage = 100 * ($i - $low + 1) / ($high - $low + 1)    
    ProgressSet( $percentage, Int($percentage) & " percent")
Next
ProgressSet(100 , "Done", "Complete")
sleep(500)
ProgressOff()
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Posted

@galpha: why not use:

...
$perc = Int($P / $I * 100)
GUISetControlEx($myProgressControl, $perc)
...

Holger

Hey really big thanks, works like a charm.

@Cyber

Tx your code also works just that his method is shorter.

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
×
×
  • Create New...