Jump to content

get an error about this script


Recommended Posts

#include <misc.au3>
FileChangeDir ( @ScriptDir )
$compile = _compile ( 'compileTest.au3', 'compileTest.exe' )
If $compile = 1 Then MsgBox ( 64, "Information", "Script compiled successfully" )
ElseIf $compile = 0 Then MsgBox ( 64, "Information", "Script wasn't compiled. An unknown error occured during compilation." )
ElseIf $compile = -1 Then MsgBox ( 64, "Information", "Script wasn't compiled. Either the source file wasn't found, or it wasn't an AutoIt v3 script." )
ElseIf $compile = -2 Then MsgBox ( 64, "Information", "Script wasn't compiled. Destination must be an executable file (exe)" )
ElseIf $compile = -3 Then MsgBox ( 64, "Information", "Script wasn't compiled. Icon specified was either not found, or not an icon file (ico)" )
ElseIf $compile = -4 Then MsgBox ( 64, "Information", "Script wasn't compiled. Aut2Exe.exe was not found." )
EndIf

i get an error about this line:

ElseIf $compile = 0 Then MsgBox ( 64, "Information", "Script wasn't compiled. An unknown error occured during compilation." )

C:\Documents and Settings\Pat\My Documents\autoit\compileTestRun.au3(5,1) : ERROR: syntax error
ElseIf
^

whats wrong here?

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

each if or elsif would need an edif... but this is easier

#include <misc.au3>
FileChangeDir ( @ScriptDir )
$compile =  _compile ( 'compileTest.au3', 'compileTest.exe' )
If $compile = 1 Then MsgBox ( 64, "Information", "Script compiled successfully" )
If $compile = 0 Then MsgBox ( 64, "Information", "Script wasn't compiled. An unknown error occured during compilation." )
If $compile = -1 Then MsgBox ( 64, "Information", "Script wasn't compiled. Either the source file wasn't found, or it wasn't an AutoIt v3 script." )
If $compile = -2 Then MsgBox ( 64, "Information", "Script wasn't compiled. Destination must be an executable file (exe)" )
If $compile = -3 Then MsgBox ( 64, "Information", "Script wasn't compiled. Icon specified was either not found, or not an icon file (ico)" )
If $compile = -4 Then MsgBox ( 64, "Information", "Script wasn't compiled. Aut2Exe.exe was not found." )

8)

NEWHeader1.png

Link to comment
Share on other sites

  • Developers

whats wrong here?

When you have an IF like this its considered to be a ONE LINE IF statements.

If $compile = 1 Then    MsgBox(64, "Information", "Script compiled successfully")

This will work:

#include <misc.au3>
FileChangeDir(@ScriptDir)
$compile = _compile ('compileTest.au3', 'compileTest.exe')
If $compile = 1 Then
    MsgBox(64, "Information", "Script compiled successfully")
ElseIf $compile = 0 Then 
    MsgBox(64, "Information", "Script wasn't compiled. An unknown error occured during compilation.")
ElseIf $compile = -1 Then 
    MsgBox(64, "Information", "Script wasn't compiled. Either the source file wasn't found, or it wasn't an AutoIt v3 script.")
ElseIf $compile = -2 Then 
    MsgBox(64, "Information", "Script wasn't compiled. Destination must be an executable file (exe)")
ElseIf $compile = -3 Then 
    MsgBox(64, "Information", "Script wasn't compiled. Icon specified was either not found, or not an icon file (ico)")
ElseIf $compile = -4 Then 
    MsgBox(64, "Information", "Script wasn't compiled. Aut2Exe.exe was not found.")
EndIf
Edited by JdeB

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

now i get an error about File.au3, which i haven't even touched...

Func _FileCountLines($sFilePath)
    Local $N = FileGetSize($sFilePath) - 1
    If @error Or $N = -1 Then Return 0
    Return StringLen(StringAddCR(FileRead($sFilePath, $N))) - $N + 1
EndFunc ;==>_FileCountLines

line 24: Func statement has no matching EndFunc

But whats wierd is, it only comes up with that error if i include it, but if i run File.au3 directly, i dont get any errors.

Edited by theguy0000

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
Share on other sites

  • Developers

now i get an error about File.au3, which i haven't even touched...

Func _FileCountLines($sFilePath)
    Local $N = FileGetSize($sFilePath) - 1
    If @error Or $N = -1 Then Return 0
    Return StringLen(StringAddCR(FileRead($sFilePath, $N))) - $N + 1
EndFunc;==>_FileCountLines

line 24: Func statement has no matching EndFunc

But whats wierd is, it only comes up with that error if i include it, but if i run File.au3 directly, i dont get any errors.

Long shot: Did you put the #include<file.au3> inside a Func...EndFunc ???

If not you need to show your code.... ;)

Edited by JdeB

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

Long shot: Did you put the #include<file.au3> inside a Func...EndFunc ???

If not you need to show your code.... ;)

oh, yes i did :P thanks

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

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