galpha Posted May 12, 2004 Share Posted May 12, 2004 (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 and where I put it in my code. Tx Edited May 12, 2004 by galpha Link to comment Share on other sites More sharing options...
CyberSlug Posted May 12, 2004 Share Posted May 12, 2004 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! Link to comment Share on other sites More sharing options...
galpha Posted May 12, 2004 Author Share Posted May 12, 2004 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 ? Link to comment Share on other sites More sharing options...
Holger Posted May 12, 2004 Share Posted May 12, 2004 @galpha: why not use: ... $perc = Int($P / $I * 100) GUISetControlEx($myProgressControl, $perc) ... Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView Link to comment Share on other sites More sharing options...
CyberSlug Posted May 12, 2004 Share Posted May 12, 2004 Assuming the for loop it like this: For $P = $low to $highUse a forumla like this to scale the result$percentage = 100 * ($P - $low + 1) / ($high - $low + 1)Assuming that $low < $high and both are positive integersHere's an example usingProgressOn; you should be able to adapt it to GuiSetControlEx 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! Link to comment Share on other sites More sharing options...
galpha Posted May 12, 2004 Author Share Posted May 12, 2004 @galpha: why not use: ... $perc = Int($P / $I * 100) GUISetControlEx($myProgressControl, $perc) ... HolgerHey really big thanks, works like a charm. @Cyber Tx your code also works just that his method is shorter. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now