superstylink Posted July 15, 2004 Posted July 15, 2004 I created an utility that create 2 csv file , now I want to implemnet a progress bar running till this task it's complete , I'm thinking about while loop checking the exsistence of the file and the loop realese true the progress bar stop. any help ?
Proof Posted July 15, 2004 Posted July 15, 2004 You mean a 2-step progress bar ? How long does it take to create two .csv files? How are the two files created? A file exists when you begin writing into it, so checking for the bare existence would be not very precise. You could use the size of the file (FileGetSize) or something. Don't really get the need of a progress bar, when creating two text files
superstylink Posted July 15, 2004 Author Posted July 15, 2004 ciao Proff , yes I need a progres bar 'cos I do a web query after I convert all the data in 2 csv file it depends about the connections peed so I need a progress bar til the job is done the csv does'nt exist before infact my utility name it with date function. At the moment I'm using a while incremental loop but it's just a count not real progress job bar
SlimShady Posted July 15, 2004 Posted July 15, 2004 (edited) A progress bar has to measure something. Like lines in text file, items in category, files in folder. AutoIt can't see what other applications are doing, so you can't measure it. And a progressbar that goes 50% -> 100% (for two files) isn't useful (to me). Edited July 15, 2004 by SlimShady
superstylink Posted July 15, 2004 Author Posted July 15, 2004 my progress bar gotta run til the the file exist this is the meta code $file1=1.csv $file2=2.csv while ( 1.csv==0 ||2.csv==0) { // progress bar code }
SlimShady Posted July 15, 2004 Posted July 15, 2004 (edited) my progress bar gotta run til the the file exist this is the meta code $file1=1.csv $file2=2.csv while ( 1.csv==0 ||2.csv==0) { // progress bar code }Two steps: File does not exist -> File does exist If you have two files, that's 50% per file. 0% -> 50% -> 100% So, that's like I said: And a progressbar that goes 50% -> 100% (for two files) isn't useful (to me).Suggestion: Create a splashtext box that updates when a file does exist: SplashTextOn("SplashWindow", "", -1, -1, -1, -1, 4, "") For $i = 1 To 2 If $i = 1 Then $file = "path\to\file1" If $i = 2 Then $file = "path\to\file2" While Not FileExists($file) Sleep(500) WEnd ControlSetText("SplashWindow", "", "Static1", $file & " exists!") Next SplashOff() Edited July 15, 2004 by SlimShady
superstylink Posted July 15, 2004 Author Posted July 15, 2004 thanx alot SlimShady I 'll try your code on my application ciao
superstylink Posted July 15, 2004 Author Posted July 15, 2004 some problem to run this snippet any help guys? -------------------------------- ; splash screen wait SplashTextOn("SplashWindow", "", -1, -1, -1, -1, 4, "") ;l 2excel macro run('"C:\Programmi\Microsoft Office\OFFICE11\EXCEL.EXE" "C:\Programmi\Q2 Tuner\path\first.xls"' ) run('"C:\Programmi\Microsoft Office\OFFICE11\EXCEL.EXE" "C:\Programmi\Q2 Tuner\path\second.xls"' ) For $i = 1 To 2 If $i = 1 Then $file = "path\first.xls" If $i = 2 Then $file = "path\second.xls While Not FileExists($file) Sleep(500) WEnd ControlSetText("SplashWindow", "", "Static1", $file & " exists!") Next SplashOff()
Davman Posted July 19, 2004 Posted July 19, 2004 As it's been previously explained... if your writing to the file with an external program, and nothing about the actual file changes until the last part of the write, nothing in auto-it is going to let you pick up the status of the file creation. Either make the file in autoit, or make your other program create the file, and add text to it step by step, then count the amount of lines, how many total lines your expecting, divide the two, and you have the math for a progress bar. Sitting comfortably behind the code.
SlimShady Posted July 19, 2004 Posted July 19, 2004 First:If $i = 1 Then $file = "path\first.xls"If $i = 2 Then $file = "path\second.xlsYou should replace those with full path names with the appropriate filenames.Second:@DavmanI think that last idea may not work. Because it is possible that an application opens and locks the text file to write so other applications can't use/read the file.
Davman Posted July 22, 2004 Posted July 22, 2004 Hmm, possible... but sometimes i find that only high data files are locked when being written. Anyways, like i said, get autoit to make the file, that'll fix stuff up nicely. Sitting comfortably behind the code.
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