Draygoes Posted February 9, 2008 Share Posted February 9, 2008 Ok, this is for future ref. I will use building a file shredder as an example. #include<File.au3> $lines = _FileCountLines( "C:\users\ect") $currentline = 0 For $currentline = 1 To $lines Step 1 _FileWriteToLine( "c:\users\ect", "0000000000000000000000", 1) Next Exit If I wanted to add a progress bar to the process, I would need to be able to calculate what line it is out of 100. This would be easy if the file was exactly 100 lines long, but I hardly think you would ever find a file that is exactly 100 lines. What equasion might I use to calculate the % complete, and put that in a verable that the progress bar can use? Thanks all. Sorry if I have not explained this well enough. Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. Link to comment Share on other sites More sharing options...
Developers Jos Posted February 9, 2008 Developers Share Posted February 9, 2008 something like : $currentline/$lines *100 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
rasim Posted February 9, 2008 Share Posted February 9, 2008 Yes. As saying a Jos Example:#include <File.au3> ;$lines = _FileCountLines( "C:\users\ect") $lines = 78 ProgressOn("Please wait..", "Writing strings", "", -1, -1, 16) For $i = 1 To $lines ;_FileWriteToLine( "c:\users\ect", "0000000000000000000000", 1) $percent = Round($i / $lines * 100) ProgressSet($percent, $percent & "% done") Sleep(100) Next ProgressSet(100, "Done") Sleep(1000) ProgressOff() Exit Link to comment Share on other sites More sharing options...
Draygoes Posted February 29, 2008 Author Share Posted February 29, 2008 Thanks guys. This is exactly what I was looking for. Spoiler "If a vegetarian eats vegetables,What the heck does a humanitarian eat?" "I hear voices in my head, but I ignore them and continue on killing." "You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring." An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist. 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