Sign in to follow this  
Followers 0
SSJoco

Folder lock after script run

6 posts in this topic

Hi!

I have a little Autoit script (1200 lines). This script scan files and folders, then copy some files or start WinRAR. That's all!

However after the scan and copy, all the source folders is locked. I have to close the script then delete the folder. It means the script still user this folders. I search every possible command which is use direcory, but nothing. I use FileFindFirstFile command which request Fileclose operation and I have every close commands.

Any idea how can I find whick command lock the dir?

Share this post


Link to post
Share on other sites



Hi!

I have a little Autoit script (1200 lines). This script scan files and folders, then copy some files or start WinRAR. That's all!

However after the scan and copy, all the source folders is locked. I have to close the script then delete the folder. It means the script still user this folders. I search every possible command which is use direcory, but nothing. I use FileFindFirstFile command which request Fileclose operation and I have every close commands.

Any idea how can I find whick command lock the dir?

Same problem when you use it compiled ?


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

It locks the folder both au3 and exe as well.

I attached the whole script.

winrar4ever() function do the main job. Lock every folder which contains *.rar file until I do not close the program. I do the same thinh with *.avi, *.nfo files, only I copy them, but it do not lock the folders.

I use _Filelisttoarray only in the rar search, because I have found this command recently.

WinRAR4ever.au3

Share this post


Link to post
Share on other sites

Had a quick glance at your code and saw at least one instance where you do not properly close a filehandle:

$searchsample = FileFindFirstFile("*sample*.*")
            If $searchsample = -1 And FileExists($source & "\" & $rar[$b] & "\Sample") Then
                FileChangeDir($source & "\" & $rar[$b] & "\Sample")
                $searchsample = FileFindFirstFile("*.*")
            EndIf

You want to FileClose($searchsample ) before doing another FileFindFirst().

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I think I've got it!

I do FileFindFirstFile inside the loop, but I closed the handler after the loop. If I close the search handler at the end of the loop then it won't lock the folders.

Uh, I haven't edited this program for a while.

Thanks For The Help

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