Sign in to follow this  
Followers 0
superstylink

progress bar

11 posts in this topic

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 ?

Share this post


Link to post
Share on other sites



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 :ph34r:

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by SlimShady

Share this post


Link to post
Share on other sites

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

}

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by SlimShady

Share this post


Link to post
Share on other sites

thanx alot SlimShady I 'll try your code on my application

ciao

Share this post


Link to post
Share on other sites

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()

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

First:

If $i = 1 Then $file = "path\first.xls"

If $i = 2 Then $file = "path\second.xls

You should replace those with full path names with the appropriate filenames.

Second:

@Davman

I 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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0