Jump to content

File Lock


Recommended Posts

Is there a way to test if another application has a lock on a file ... I can do a fileMove to test this but I have noticed when I do this using FileMove the CPU usage during this process spikes at 90%+ if the file is locked ....

I am using this FileMove in an adlib that sleeps every second and rechecks this to keep the CPU load from ataying at 90%+ However I would like to remove the cpuload so I can speed up the script.

Any ideas how to test the file has a lock without trying to move the file to determine this ..

Many Thanks

Link to comment
Share on other sites

  • Moderators

FileOpen() in read mode doesn't work for you?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I dont want to open the file as it is an executable -

Here is a more detailed description of what I am doing

- .exe File lands on a client but when it lands the server pushing it does not release it stright away

- My script is looking for the exe landing once there it will try to execute it

- My script fails to execute it as the server pushing the file still has a lock on it.

- I am therefore using file move to determine when the lock has completed so I can launch the file

Link to comment
Share on other sites

I dont want to open the file as it is an executable -

Here is a more detailed description of what I am doing

- .exe File lands on a client but when it lands the server pushing it does not release it stright away

- My script is looking for the exe landing once there it will try to execute it

- My script fails to execute it as the server pushing the file still has a lock on it.

- I am therefore using file move to determine when the lock has completed so I can launch the file

You could add a sleep() so that if it sees it, the sleep will go first then kick off the file.

Link to comment
Share on other sites

You could add a sleep() so that if it sees it, the sleep will go first then kick off the file.

Hi,

maybe a combination of _Net_Share_FileEnum and _Net_Share_FileGetInfo gives you a clou.

;-))

Stefan

Link to comment
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
 Share

  • Recently Browsing   0 members

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