Jump to content

wait while file being written [solved]


Recommended Posts

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]
Link to comment
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.

Edited by KaFu
Link to comment
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]
Link to comment
Share on other sites

  • 2 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...