Sign in to follow this  
Followers 0
Fanatick

Error line 10

5 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



What is this script suppose to do? I couldn't read the remarks in the code since I only speak English.

Share this post


Link to post
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~

Share this post


Link to post
Share on other sites

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

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

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