Jump to content

How do you run the syntax checker from a batch file


 Share

Recommended Posts

First of all, I discovered AutoIT about a week ago and have already automated the installation of our software product. The help pages were very clear and the language was easy to learn!

In SciTE, when I select Tools -> SyntaxCheck Prod, it checks the code and prints out a clear, detailed report of any syntax errors in the script.

I created a batch script that builds my AutoIT script into an executable but I noticed that it doesn't check for any syntax errors. Aut2exe.exe seems to always return an exit code of 0. Is there some way to run the syntax checker from a batch script and have it report the syntax errors to the console and if there are any errors then it returns an exit code of 1 and if it's successful then it returns an exit code of 0.

As it is right now, I always have to run the syntax checker via SciTE editor but it would be nice if I could run it via a console version so that I could run it via a batch script.

Thanks!

Monty

Link to comment
Share on other sites

Have you tried just calling Au3Check.exe from your batch file?

It's in the AutoIt3 folder.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

  • Developers

Run au3check :

C:\Program Files (x86)\AutoIt3>au3check
AutoIt3 Syntax Checker v1.54.8  Copyright (c) Tylo 2007

Usage: Au3Check [-q] [-d] [-u file] [-w[-] n].. [-v[-] n].. [-I dir].. file.au3
            -q      : quiet (only error/warn output)
            -d      : as Opt("MustDeclareVars", 1)
            -I dir    : additional directories for searching include files
            -w 1      : already included file (on)
            -w 2      : missing #comments-end (on)
            -w 3      : already declared var (off)
            -w 4      : local var used in global scope (off)
            -w 5      : local var declared but not used (off)
            -w 6      : warn when using Dim (off)
            -v 1      : show include paths/files (off)
            -v 2      : show lexer tokens (off)
            -v 3      : show unreferenced UDFs and global variables (off)
       Exit codes:
             0      : success - no errors or warnings
             1      : warning(s) only
             2      : syntax error(s)
             3      : usage or input error

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

That was helpful. However, au3check.exe seems to return 0 for the exit code even where there's errors. For example, here's the snippet from my batch script:

"C:\Program Files (x86)\AutoIt3\Au3Check.exe" -q test.au3

IF ERRORLEVEL 0 (

ECHO Success!

) ELSE (

REM The syntax checker found one or more errors or warnings. Exiting the script.

EXIT 1

)

and here's the output from running the batch script:

E:\temp\test.au3(70,18) : ERROR: ExdfsdaftLoop(): undefined function.

ExdfsdaftLoop()

~~~~~~~~~~~~~~^

test.au3 - 1 error(s), 0 warning(s)

Success!

The help text for au3check indicates this for the exit codes:

Exit codes:

0 : success - no errors or warnings

1 : warning(s) only

2 : syntax error(s)

3 : usage or input error

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