Jump to content

Error line 10


Recommended Posts

Hey , i have a error line 10 , if you can help me thanks

I found the error line 10 but now i have a error line 13 ^^

Error : "EndIf" statement with no matching "If" statement

#include <File.au3>

Dim $Res
Dim $File = "File.txt"; File to find.

$aDrv = DriveGetDrive("FIXED")

;A circle who search and attribut to the first find file  $File find.
For $i = 1 To $aDrv[0]
    $aFile = _FileListToArrayEx2($aDrv[$i], $File, 1, "", True)
    If IsArray($aFile) And $aFile[1] <> "" Then $Res = $aFile[1]
        ExitLoop
    EndIf
Next

; If a file is find then  :
If $Res <> "" Then
    Dim $szDrive, $szDir, $szFName, $szExt
    $TestPath = _PathSplit($Res, $szDrive, $szDir, $szFName, $szExt)

    $chemin = $szDrive & $szDir
    $NomFichier = $szFName & $szExt
    MsgBox(0, "", "Fileacess = " & $Fileacess & @CRLF & "File  = " & $Filename)
; Otherwise ...
Else
    MsgBox(16, "Error", "The file was not find")
EndIf
Edited by Fanatick
Link to comment
Share on other sites

Change it to:

If IsArray($aFile) And $aFile[1] <> "" Then
        $Res = $aFile[1]
        ExitLoop
    EndIf

If the "ExitLoop" is suppose to be an "else" action then it would look like this:

If IsArray($aFile) And $aFile[1] <> "" Then
        $Res = $aFile[1]
    Else
        ExitLoop
    EndIf

~Flint Brenick~

Link to comment
Share on other sites

  • Developers

Tidy makes your life realy easier with these sort of issues. ;)

#include <File.au3>
Dim $Res
Dim $File = "File.txt"; File to find.
$aDrv = DriveGetDrive("FIXED")
;A circle who search and attribut to the first find file  $File find.
For $i = 1 To $aDrv[0]
    $aFile = _FileListToArrayEx2($aDrv[$i], $File, 1, "", True)
    If IsArray($aFile) And $aFile[1] <> "" Then $Res = $aFile[1]
    ExitLoop
;### Tidy Error -> "endif" is closing previous "for" on line 7
EndIf
;### Tidy Error: next line creates a negative tablevel.
;### Tidy Error: next line creates a negative tablevel for the line after it.
Next
; If a file is find then  :
If $Res <> "" Then
    Dim $szDrive, $szDir, $szFName, $szExt
    $TestPath = _PathSplit($Res, $szDrive, $szDir, $szFName, $szExt)
    $chemin = $szDrive & $szDir
    $NomFichier = $szFName & $szExt
    MsgBox(0, "", "Fileacess = " & $Fileacess & @CRLF & "File  = " & $Filename)
; Otherwise ...
Else
    MsgBox(16, "Error", "The file was not find")
EndIf

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...