Jump to content

How i can use again array .?


Recommended Posts

The script work but on 2 round not see the file ,, how I can use again "$v[1] , $v[2] - $v[5] ..?

I can use on code fore return the $v[1] to -1 if $v[1] find the file .?

How I cand use the array another , another again ..?

#Include <File.au3>
#Include <Array.au3>
#NoTrayIcon

$v=_FileListToArray("D:\Documents1", '*', 2)
If @Error=1 Then
    MsgBox (0,"","Error ")
    Exit
EndIf

$bLoop = 1
While $bLoop = 1
    
            
            $bos = "D:\Documents1\" & $v[1] 
             $search1 = FileFindFirstFile($bos &"\index_06[1]oooooooooo.gif")           
        if $search1=1 Then
            MsgBox(0,"ok-1","Find")
        Else        
        ;MsgBox(0,"else-1",$bos)
        ;---next-folder
                $bos2 = "D:\Documents1\" & $v[2] 
                $search2 = FileFindFirstFile($bos2 &"\index_06[1]oooooooooo.gif")           
            if $search2=1 Then
                 MsgBox(0,"ok-2","Find")
            Else        
                ;MsgBox(0,"ddddd",$search2)
                ;---next-folder
                    $bos3 = "D:\Documents1\" & $v[3] 
                    $search3 = FileFindFirstFile($bos3 &"\index_06[1]oooooooooo.gif")           
                if $search3=1 Then
                    MsgBox(0,"ok-3","Find")
                Else        
                  ;MsgBox(0,"ddddd",$search3)
                ;--next-folder---3
                         $bos4 = "D:\Documents1\" & $v[4] 
                         $search4 = FileFindFirstFile($bos4 &"\index_06[1]oooooooooo.gif")          
                    if $search4=1 Then
                         MsgBox(0,"ok-4","Find")
                    Else        
                    ;MsgBox(0,"ddddd",$search4)
                    ;--next-folder-4
                             $bos5 = "D:\Documents1\" & $v[5] 
                             $search5 = FileFindFirstFile($bos5 &"\index_06[1]oooooooooo.gif")          
                        
                      EndIf
                EndIf
            EndIf
        EndIf
        

             MsgBox(0,"kk","tura")
             Sleep(3000)
             $bLoop = 1
        
WEnd
Link to comment
Share on other sites

As much as I can understand this script purpose....

First, your code include unnecessary comparisons and statements. For example the $bLoop is completely unnecessary, use While 1...WEnd instead and if you want to finish the loop use the ExitLoop statement. Second, "If $search2=1 Then" is equivalent to "If $search2 Then" and faster.

If you want to find specific file using the FileFindFirstFile...FileFindNextFile....FileClose, it required recursive function because you probably don't know all the folder and where it can be found so use recursive function with FileGetAttrib to check if a file is folder or not...

Good-luck.

Link to comment
Share on other sites

Use FileExist instead if you know the paths.

Edit: Don't forget that you need to check whether the file is folder or simple file. In case you didn't know there are two other files in each folder (root is exception) ---> '.' and '..' so these two are also included in the returned array I think

Edited by Authenticity
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...