Sign in to follow this  
Followers 0
CGAnimator

how to make a file in use ?!

8 posts in this topic

hi there

My script creates some files in the temp dir so he get some information from them later.

after a while they don't have any use.

my problem is sometimes windows or cleaning prog (like CCleaner) deletes those files.

can i make those files in use by my autoit script ?!

i mean if some one or a program is trying to delete those files rename theme the windows refuse because it's in use by another application (my script).

and it'll be cool if it dos'nt take much of my computer resources.

Share this post


Link to post
Share on other sites



$hFile = FileOpen($file)

then when you don't need it

FileClose($hFile)

maybe....?

Share this post


Link to post
Share on other sites

WOW

that must be the fastest replay i get in my life :whistle:

thanx man, realy thanx .

i'll try that and then ask another stupid Q ;) .

Share this post


Link to post
Share on other sites

it works just fine thanx ;)

it takes a lot of resources if you put it in a loop , I tryed "sleep" and it's kinda fair now thanx :whistle:

Share this post


Link to post
Share on other sites

I don't think you need any sort of sleep. Just make a simple gui with buttons to select the file you want then a button to either open or close it.

I'm not sure but I think the file will remain open even if you close the script. That way you could open the file, close the script and no cycles are used at all on it. You could then restart your script to close the file.

Just an :whistle:


Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites

I don't think you need any sort of sleep. Just make a simple gui with buttons to select the file you want then a button to either open or close it.

I'm not sure but I think the file will remain open even if you close the script. That way you could open the file, close the script and no cycles are used at all on it. You could then restart your script to close the file.

Just an :whistle:

no, it automatically closes the file on exit.

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post


Link to post
Share on other sites

no, it automatically closes the file on exit.

That's right theguy0000 ...

when the script closes autoit automatically proceed a (FileClose) function.

Share this post


Link to post
Share on other sites

it works just fine thanx ;)

it takes a lot of resources if you put it in a loop , I tryed "sleep" and it's kinda fair now thanx :whistle:

Your not putting the code I gave you in a loop are you??

$hFile = FileOpen("myfile.ext", 0)
while (true)
;Do something while file is in use.
wend
FileClose($hFile)

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