Stuempi Posted November 5, 2009 Posted November 5, 2009 (edited) Ok lads, another little problem from me... I'm trying to add a progress bar to my nifty little script. The script works fine and is running several programs. Now I want the progress bar to display the progress procentual to the number of programs already started. So I have $numberPrograms as the total number of programs which will be started. That's what I came up with: DIM $count = 1 DIM $numberPrograms = 35 ProgressOn("Progress Meter", "Programs run...", "Program Nr. " & $count & " of " & $numberPrograms) For $i = $count + 1 to $numberPrograms step $count $count = $count + 1 RunWait("notepad.exe") ProgressSet( $i, "Program Nr. " & $i & " of " & $numberPrograms) Next ProgressSet(100 , "Done", "Complete") sleep(500) ProgressOff() Mostly I took the stuff from the help file, but now I have problems setting the processSet right for the procentual amount of programs to run?! Hope you can help me... thanks! Edited November 5, 2009 by Stuempi
BinaryBrother Posted November 5, 2009 Posted November 5, 2009 (edited) I'm not that great at math, but I do know to anyone who is, this is a simple solution. If your running 35 programs, and you want the progress to be at 100% when you have ran the 35th program, division should answer that... 100/35 = multiplier... In other words... For 35 programs, your code would look like so... DIM $numberPrograms = 35 ProgressOn("Progress Meter", "Programs run...", "Program Nr. 0 of " & $numberPrograms) For $i = 1 to $numberPrograms RunWait("notepad.exe") ProgressSet(Number($i*2.8571428571428571428571428571429), "Program Nr. " & $i & " of " & $numberPrograms) Next ProgressSet(100 , "Done", "Complete") sleep(500) ProgressOff() As for generating that on the fly... I would assume it should look something like this... DIM $numberPrograms = 35 DIM $multiplier = Number(100/$numberPrograms) ProgressOn("Progress Meter", "Programs run...", "Program Nr. 0 of " & $numberPrograms) For $i = 1 to $numberPrograms RunWait("notepad.exe") ProgressSet(Number($i*$multiplier), "Program Nr. " & $i & " of " & $numberPrograms) Next ProgressSet(100 , "Done", "Complete") sleep(500) ProgressOff() I could be way off, and I didn't test any of that... but it looks right... Edited November 5, 2009 by BinaryBrother SIGNATURE_0X800007D NOT FOUND
Stuempi Posted November 5, 2009 Author Posted November 5, 2009 Hey BinaryBrother, you had a small mistake there... DIM $multiplier = Number($numberPrograms/100) should be DIM $multiplier = Number(100/$numberPrograms) otherwise it works exactly as I wanted it. Thank you very much
Malkey Posted November 5, 2009 Posted November 5, 2009 I changed the abbreviation for number to No. This is based on Latin: numero. Dim $count = 0 Dim $numberPrograms = 35 ProgressOn("Progress Meter", "Programs run...", "Program No. " & $count & " of " & $numberPrograms) For $i = 0 To $numberPrograms - 1 ProgressSet(100 * $count / $numberPrograms, "Program No. " & $i & " of " & $numberPrograms) Sleep(1000) $count = $count + 1 Next ProgressSet(100, "Done", "Complete") Sleep(2000) ProgressOff()
BinaryBrother Posted November 5, 2009 Posted November 5, 2009 Glad to have been of some assistance. My bad on the inversion... x.x SIGNATURE_0X800007D NOT FOUND
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