myspacee Posted December 26, 2008 Share Posted December 26, 2008 (edited) hello to all, want to understand 'exitloop' use, post guide example: ; Shows the filenames of all files in the current directory. $search = FileFindFirstFile("*.*") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop MsgBox(4096, "File:", $file) WEnd ; Close the search handle FileClose($search) my code is very similar but contains another while on top : (used to check IN directory every 5 seconds) While 1 ; Shows the filenames of all files in the current directory. $search = FileFindFirstFile("*.*") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $file = FileFindNextFile($search) If @error Then ExitLoop MsgBox(4096, "File:", $file) WEnd ; Close the search handle FileClose($search) sleep(5000) WEnd FileFindNextFile($search) search for new files to compare with production ones (often, more than one) when finish, exitloop quit application and my monitor directory terminate. how can i close only 'internal' while ? thank you as usual, m. Edited December 26, 2008 by myspacee Link to comment Share on other sites More sharing options...
FireFox Posted December 26, 2008 Share Posted December 26, 2008 (edited) @myspacee Maybe... Do ;something Until @error Edit : Do $file = FileFindNextFile($search) MsgBox(4096, "File:", $file) Until $file = -1 or @error Cheers,FireFox Edited December 26, 2008 by FireFox Link to comment Share on other sites More sharing options...
Floppy Posted December 26, 2008 Share Posted December 26, 2008 Don't use the While function...use another loop such as Do or For... Link to comment Share on other sites More sharing options...
myspacee Posted December 26, 2008 Author Share Posted December 26, 2008 thank you both, m. Link to comment Share on other sites More sharing options...
Valuater Posted December 26, 2008 Share Posted December 26, 2008 Maybe... #Include <File.au3> Global $Location = @HomeDrive Global $Pause = 5000; miliseconds $FileList=_FileListToArray($Location, "*", 1) While 1 Sleep($Pause) $FileList2=_FileListToArray($Location, "*", 1) If $FileList[0] <> $FileList2[0] Then MsgBox(0,"Notice", "There is a file change in this folder " & @CRLF & $Location & " ", 5) ; do something... Exit EndIf WEnd 8) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now