# Au3Check.exe

## Recommended Posts

Tylo,

I think this code should not generate an au3check error:

WARNING: $errorlog: possibly used before declaration. If IsDeclared("errorlog") AND FileExists($errorlog)

##### Share on other sites

some kind of warning is correct

While appreciated, I was not requesting a stylistic critique, rather a clarification of the points as laid out.

An error should not be thrown in that situation, IMO, because the AND operation ensures that if the left side evaluates to false then the right side is not evaluated at runtime. If my belief that the behavior of au3 is as outlined, then it is impossible to have a situation where the variable is used w/o being declared, and, therefore, the warning of a "possible use of variable before declaration" error is misleading at best.

While the method you propose is indeed more elegant, it is no less functional (nor no less syntactically accurate). I believe that the points of logic (if not the style points ) are valid.

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

##### Share on other sites

A stylistic critique is required since you are mixing two distinctly different styles or variable access which is a bad thing to do. Do you want to use a variable who's existence is unknown until run time or do you want to use a variable that you know at design time? Either do one or the other but don't do both. It's both confusing to the programmer and definitely confusing to a syntax checker which doesn't parse the code for fringe coding styles.

The code is technically correct but that doesn't mean it shouldn't be flagged with a warning for something. There are other examples of correct code but which is deprecated (Keyword Dim) or just bad style (Declaring Global variables inside a function). While this warning doesn't strictly pertain to mixing variable access styles, it does provide a hint that the code needs some review and possible modification.

Keep in mind, "This code works" is not all the criteria necessary for "this code doesn't generate warnings". Also remember that anytime you use IsDeclared() and want to access the variable you are checking, you should always use either Assign() or Eval() to access the contents of the variable.

##### Share on other sites

So maybe we need a warning that says "Valik wouldn't code it that way"

If FileExists(Eval("errorlog"))

I do agree that this is cleaner, I'm just not accustomed to using Eval() or Assign() for anything, and forget that they're even available.

Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

##### Share on other sites

Also remember that anytime you use IsDeclared() and want to access the variable you are checking, you should always use either Assign() or Eval() to access the contents of the variable.

This should be present in the documentation of IsDeclared(), if it isn't already.

blub

##### Share on other sites

This should be present in the documentation of IsDeclared(), if it isn't already.

Yes, and probably Assign() and Eval(), too. I'll send some updated documentation to JP when I remember.

##### Share on other sites

The following code gives me an unwanted error in Au3Check v1.54.

_Test(False)
HotKeySet('^{F12}', '_Test')

Func _Test($Val = True) EndFunc Comment the first line and the error disappears. #### Share this post ##### Link to post ##### Share on other sites The following code gives me an unwanted error in Au3Check v1.54. _Test(False) HotKeySet('^{F12}', '_Test') Func _Test($Val = True)
EndFunc

Comment the first line and the error disappears.

Well, the error is correct but that's pure luck I think.

If parameters are used in a callback function which is being invoked via some other mechanism than Call() or GUIRegisterMsg(), AutoIt it will error out at run-time. This should probably get a warning from Au3Check. However, SlimShady is correct, the warning, while somewhat correct for the problem in the script, isn't actually generated because of the problem in the script.

By the way, SlimShady, it would be helpful if you actually told us what message you are getting and what your Au3Check options are. That example gives me one error and one warning with my Au3Check options, for example.

##### Share on other sites

I always run with only the -q option.

If $bHotkey Then MsgBox(4096, "", "Hotkey invoked") EndFunc #### Share this post ##### Link to post ##### Share on other sites Since there is no SciTe config for Au3Check, what line in CompileAU3.au3 do I need to change to use these switches everytime I run SciTe's SyntaxCheck Beta? Is it this one (line 821): $RC = Run(FileGetShortName($Au3checkpgm) & ' -q "' &$ScriptFile_In & '"', '', @SW_HIDE, 2)

Do I just add the options I want to use after the '-q' above?

##### Share on other sites

Since there is no SciTe config for Au3Check, what line in CompileAU3.au3 do I need to change to use these switches everytime I run SciTe's SyntaxCheck Beta? Is it this one (line 821):

$RC = Run(FileGetShortName($Au3checkpgm) & ' -q "' & \$ScriptFile_In & '"', '', @SW_HIDE, 2)

Do I just add the options I want to use after the '-q' above?

[Other]

Run_AU3Check=

AU3Check_Stop_OnWarning=

AU3Check_Parameter=-d -w 1 - w 2

Run_Before=

Run_After=

Check CompileAU3.INI.examples for all possible defaults you can set.

Live for the present,
Dream of the future,
Learn from the past.

##### Share on other sites

I tried putting those lines into 'C:\Program Files\AutoIt3\SciTe\CompileAU3\CompileAU3.ini' but it didn't seem to do anything for me JdeB

##### Share on other sites

I tried putting those lines into 'C:\Program Files\AutoIt3\SciTe\CompileAU3\CompileAU3.ini' but it didn't seem to do anything for me JdeB

Looking at the script-line you posted I am pretty sure you aren't running the latest version of CompileAU3 which is part of the SciTE4AutoIt3 installer posted Jan 19, 2006.

Live for the present,
Dream of the future,
Learn from the past.

##### Share on other sites

You hit the nail on the head. Somehow I missed the latest update. Thanks.

##### Share on other sites

...Example of include statement the produces ERROR: can't open include file...

I select continue anyway, and the program compiles and runs as it should.

This code:
#include <IE.au3>
generates this in the Au3Check box:

C:\Temp\short-path-include.au3(1,10) : ERROR: can't open include file <IE.au3>

#include <IE.au3>

~~~~~~~~~^

and subsequent "undefined function" errors.

This code:

#include "C:\Program Files\AutoIt3\beta\Include\IE.au3"
works just fine with Au3Check.

I run beta code from within SciTE and I had one system that worked with the short path just fine... and one system that needed the full path. So naturally I decided to break the system that worked by installing the latest SciTE4AutoIt and Defs. Now both systems require the full path.

Ditto on the "I select continue anyway, and the program compiles and runs as it should."

Thanks tylo for this great tool that has saved me hours of hunting down typos. (Who knew that I would need to know how to type?) Anyway, I just thought that I would mentioned this. Au3Check used to find beta includes just fine and now it has trouble with at least this one. I can use the full path or just copy IE.au3 into the production include folder and Au3Check will find it just fine.

Thanks again....

[size="1"][font="Arial"].[u].[/u][/font][/size]

##### Share on other sites

This code:

#include <IE.au3>
generates this in the Au3Check box:and subsequent "undefined function" errors.

This code:

#include "C:\Program Files\AutoIt3\beta\Include\IE.au3"
works just fine with Au3Check.

I run beta code from within SciTE and I had one system that worked with the short path just fine... and one system that needed the full path. So naturally I decided to break the system that worked by installing the latest SciTE4AutoIt and Defs. Now both systems require the full path.

Ditto on the "I select continue anyway, and the program compiles and runs as it should."

Thanks tylo for this great tool that has saved me hours of hunting down typos. (Who knew that I would need to know how to type?) Anyway, I just thought that I would mentioned this. Au3Check used to find beta includes just fine and now it has trouble with at least this one. I can use the full path or just copy IE.au3 into the production include folder and Au3Check will find it just fine.

Thanks again....

The latest Beta version of AutoIt and AUT2EXE will look for the include directory as a subdirectory of the Program directory. thus c:\program files\autoit3\autoit3.exe will look in c:\program files\autoit3\include

and c:\program files\autoit3\beta\autoit3.exe will look in c:\program files\autoit3\beta\include.

The current AU3Check uses the registry entry to find the Include directory and thus only looks in :

c:\program files\autoit3\include whatever version you use.

I have made a temporary fix for this in the au3check program to use the same logic as AutoIt3 and this will be rolled out with the next SciTE4AutoIt3 installer since you also need other modifications to programs like CompileAU3 ...

Planning to make that available tomorrow if tests keep on going well.

If you are interested in a test version then sent me a PM...

Edited by JdeB

Live for the present,
Dream of the future,
Learn from the past.

##### Share on other sites

Thanks for the quick reply. I'm in no rush... I just thought I would mention it.

BTW, when I said, "Au3Check used to find beta includes just fine and now it has trouble with at least this one." I could have had IE.au3 in both include folders on that other system. So perhaps nothing has changed/regressed with Au3Check. (I can't check as I uninstalled AutoIt and SciTE as part of my testing.)

Thanks for all that you do for the AutoIt community!

[size="1"][font="Arial"].[u].[/u][/font][/size]

##### Share on other sites

I would like to retrieve the error message on warning or compile failed... I am calling au3check using runwait()

How can I do this?

I tried to redirect the result to a text file ">>test.txt" however I think perhaps runwait cannot be used with redirecting output... this works from the command prompt

Is there perhaps an environment variable that contains the error message? or a switch to enable writing output to a text file?

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...