Jump to content
Sign in to follow this  
mattw112

Compiling Autoit Scripts and Error Messages

Recommended Posts

mattw112

When compiling an Auto it script that gave us an error a dialog poped up. Is there a way to compile scripts and only have the exit codes or whatever go to the std out? In otherwords a completely silent compile?

Thanks,

Terry

Share this post


Link to post
Share on other sites
The Kandie Man

Here is a way around this problem:

If $CmdLine[0] > 0 Then
    If Not StringInStr($CmdLineRaw,"-NoErrors",1) Then RunWithoutErrors()
Else
    If @compiled Then
        RunWithoutErrors()
    Else
        Msgbox(0,"Not Compiled","Script is not compiled.  Fatal errors will be shown.")
    EndIf
EndIf

#region Main Script Goes in here

;your main script goes here
Run("asdfqwerty.exe");this would normally cause a fatal error because the executable doesn't exist, but the script exits silently

#endregion

Func RunWithoutErrors()
    Run(@AutoItExe & ' /ErrorStdOut -NoErrors')
    Exit
EndFunc

The script must be compiled for this to work correctly.

- The Kandie Man ;-)


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites
Jos

When compiling an Auto it script that gave us an error a dialog poped up. Is there a way to compile scripts and only have the exit codes or whatever go to the std out? In otherwords a completely silent compile?

Thanks,

Terry

Sure ... Many.. here are a few:

- Tell SciTE4AutoIt3 NOT to run au3Check

- Don't use SciTE4AutoIt3 at all and run aut2exe manually.

either option is "not smart" but hey ... thats only what I think ... :rolleyes:


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

Share this post


Link to post
Share on other sites
mattw112

Sure ... Many.. here are a few:

- Tell SciTE4AutoIt3 NOT to run au3Check

- Don't use SciTE4AutoIt3 at all and run aut2exe manually.

either option is "not smart" but hey ... thats only what I think ... :rolleyes:

Thanks, actually we are running aut2exe stand alone.

Share this post


Link to post
Share on other sites
mattw112

Kandie Man,

Hi I'm curious how this works?

Is it the part in the function with the command line:

/ErrorStdOut -NoErrors

If so can I just add this to the end of the aut2exe command line?

for example

aut2exe /in myscript.au2 /ErrorStdOut -NoErrors

?

Basically we currently are running an automated proces for compiling au3's when they change.

The automated process runs aut2exe

We recently had an error window appear when compiling one... so they asked me how to make this silent even with errors because in many cases no one will be around to see them.

Thanks,

Terry

Share this post


Link to post
Share on other sites
/dev/null

When compiling an Auto it script that gave us an error a dialog poped up. Is there a way to compile scripts and only have the exit codes or whatever go to the std out? In otherwords a completely silent compile?

Thanks,

Terry

I think you don't want a silent compile, but a silent run option (as you mentioned the msgbox with the error message). Run your compiled script with the commandline option /ErrorStdOut. Like this: badscript.exe /ErrorStdOut > error.txt

EDIT: O.K. I just read your update. So, you are looking for a silent compile. Then, please post the actual error message you got!

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites
mattw112

I think you don't want a silent compile, but a silent run option (as you mentioned the msgbox with the error message). Run your compiled script with the commandline option /ErrorStdOut. Like this: badscript.exe /ErrorStdOut > error.txt

EDIT: O.K. I just read your update. So, you are looking for a silent compile. Then, please post the actual error message you got!

lol,

yep a silent compile using aut2exe is what I'm looking for. The errors could be any errors, missing files, bad syntax, anything... I just dont want any message boxes because it then throws off our automated process for building these hundreds of autoit scripts. I just want a std out if there is an erro that I can get and go back to later.

Thanks,

Terry

Share this post


Link to post
Share on other sites
/dev/null

lol,

yep a silent compile using aut2exe is what I'm looking for. The errors could be any errors, missing files, bad syntax, anything... I just dont want any message boxes because it then throws off our automated process for building these hundreds of autoit scripts. I just want a std out if there is an erro that I can get and go back to later.

Thanks,

Terry

O.K. then run Au3Check before you compile the script. If Au3Check returns an error, skip the compilation for that file!

Au3Check.exe error.au3
AutoIt3 Syntax Checker v1.54  Copyright (c) Tylo 2006

error.au3(1,15) : ERROR: MsgBix(): undefined function.
MsgBix(0,"","")
~~~~~~~~~~~~~~^
error.au3 - 1 error(s), 0 warning(s)

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites
mattw112

O.K. then run Au3Check before you compile the script. If Au3Check returns an error, skip the compilation for that file!

Au3Check.exe error.au3
AutoIt3 Syntax Checker v1.54  Copyright (c) Tylo 2006

error.au3(1,15) : ERROR: MsgBix(): undefined function.
MsgBix(0,"","")
~~~~~~~~~~~~~~^
error.au3 - 1 error(s), 0 warning(s)
Thanks, I dont think that'll work either. Simply because we have tons of these scripts and we're trying to do this hands off, just automated.

Background: We have an automated process which picks up when a scripter has made changes to an autoit script (which is checked into a code repository called perforce). It moves things around and automatically builds these fioles in the background on a build server. it then moves the output to the required places which then gets picked up by Configuration manager (SCCM) and distribution points are then updated.

I guess I was just hoping that there was some command line I didn't know about for running aut2exe silently with no message boxes if something is wrong, just a std our err code, which could be monitored for.

Thanks,

Terry

Share this post


Link to post
Share on other sites
FreeFry

Maybe it would be a good future feature. :rolleyes:

Edited by FreeFry

Share this post


Link to post
Share on other sites
/dev/null

Thanks, I dont think that'll work either. Simply because we have tons of these scripts and we're trying to do this hands off, just automated.

O.K. and what stops you to run AU3Cehck "hands off"? That's a perfect solution to your problem, I don't think you want to compile a bogus script, do you?

I guess I was just hoping that there was some command line I didn't know about for running aut2exe silently with no message boxes if something is wrong, just a std our err code, which could be monitored for.

That's exactly what AU3Check gives you!

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites
FreeFry

oh, au3check.exe -q

Didn't know that. :rolleyes:

Share this post


Link to post
Share on other sites
mattw112

oh, au3check.exe -q

Didn't know that. :rolleyes:

I see. So I need to add to my process an Au3check -q across the packages before the aut2exe is run? Sounds good I think I can make that work.

We dont want to run a bogus script we just dont want to have it hold up the compiling of the other scripts which is what happens if a dialog box opens.

I do think this would be a good future request for aut2exe though 'a completely silent compilation with a std out for err codes'

Thanks,

Terry

Edited by mattw112

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  

×