Sign in to follow this  
Followers 0
lasaucisse

wait while file being written [solved]

7 posts in this topic

#1 ·  Posted (edited)

hi,

first, excuse my poor english, i'm french ;)

I'm coding un GUI for a tool, whose goal is to automate some actions with this tool, by sendind hotkeys. I have to use the send() function because the WinMenuSelectItem() function fail : no detected menu in my tool with Au3info.exe.

At the end of my hotkeys sequence, I need to save the current file, then to close it.

my problem : for big files, the saving process takes some time (several seconds), so I need to wait before to send the "close" hotkeys. So I need to know how many time I have to wait, so I need to check if the saving process is finished or not.

but I can't find the way to do that ! :evil:

I tried to checked :

- if the file can be read or write while the process...failed, no error code, I can open in read or write mode, although the file is still being written !

- the file's size : it's change during the save process, but not continuous : I can check if the file's size didn't change since seconds, but I'll have to wait at least 4 or 5 seconds to be sure it's ended : too long !

same limitation with file's timestamps...

- the file's attributes, it's "A" (archive) before, during and after the save process

So... how can I check that a file is being written by any process ?

Edited by lasaucisse

[size="1"]mostly useless softwares (sorry for old VB softs ^^) & others things[/size]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Take a look at the FileInUse function in my signature. Loop while it returns true to wait until writing has finished.

Edit: I always add a pop-up with a looping progressbar and a timer check to the loop to set a certain timeout value.

Edited by KaFu

Share this post


Link to post
Share on other sites

Take a look at the FileInUse function in my signature. Loop while it returns true to wait until writing has finished.

Edit: I always add a pop-up with a looping progressbar and a timer check to the loop to set a certain timeout value.

thanks a lot !!! I'll try and come back ;)

[size="1"]mostly useless softwares (sorry for old VB softs ^^) & others things[/size]

Share this post


Link to post
Share on other sites

thanks a lot !!! I'll try and come back :evil:

it works perfectly, thanks thanks thanks !!! ;)

[size="1"]mostly useless softwares (sorry for old VB softs ^^) & others things[/size]

Share this post


Link to post
Share on other sites

it's me again : how can I update the post's title with "resolved" or "done" ?


[size="1"]mostly useless softwares (sorry for old VB softs ^^) & others things[/size]

Share this post


Link to post
Share on other sites

AFAIK you should be able to edit it from the 1st post

whim

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

done, thanks.

Edited by lasaucisse

[size="1"]mostly useless softwares (sorry for old VB softs ^^) & others things[/size]

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