Jump to content

Compile in console mode


Recommended Posts

Is there a way to compile AutoIt scripts in console mode that is not opening any message boxes?

We are using AutoIt on a Jenkins build server. Every time an error occurs a message box opens, the build job is stopped and has to be killed. As the Jenkins node is running as a windows service there is no way to ever see the messagebox.

We have implemented a bunch of precautions including running Au3Check in console mode and UnitTests before starting the build but unfortunately from time to time an error occurs during the build. Some of these errors don't even occur when starting the build manually and these errors are extremely hard to find.

As the AutoItWrapper is open source I can easily change the AutoItWrapper to CUI application without required user interaction.

Is there a command line option for Aut2Exe that I am not aware of for console only mode?

If not is there an option planned for a future release?

Thanks in advance!

Link to comment
Share on other sites

If you hit CTRL-F7 in Scite, you will get the GUI for changing compile options, on the first tab is a check box to have it compiled to a console app.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Compile it with this option

#AutoIt3Wrapper_Change2CUI=y

You need the full SciTE package!

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

  • Developers

Try something like this:

"%Programfiles%AutoIt3SciteAutoIT3wrapperAutoIT3wrapper.exe" /in "%1" /nostatus > "%1.log"

You will get a logfile with the output you normally see in the SciTE output pane.

Jos

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

Thanks for the hint but this is not what I was looking for.

As I see in the AutoItWrapper code the /nostatus flag will only hide the progress bar window, it will not prevent messages from being shown.

The messages shown by Show_Warnings(...) will still pop up and stop execution until a button was clicked.

In the AutoItWrapper this is all solvable as I can edit the code and remove the user interaction.

To give you a simple example of the problem:

I have a line of code like this:

FileInstall("e:a.txt", "d:")

The file E:a.txt does not exist.

Now when I run

Aut2exe.exe /in d:test.au3 /out d:test.exe

Aut2Exe opens a message box telling me "Error adding file: e:a.txt".

What I need is a way to not get this message box. Compile will fail, an output into the console would be nice. But as the compiling is run on a build server with no user sitting and waiting for a message box it would really be helpful to have an option to remove the message boxes.

Edited by PalorToff
Link to comment
Share on other sites

You could always make sure that your code is error free before compiling. That's the usual way to avoid error messages, don't have errors. :D

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

You could always make sure that your code is error free before compiling. That's the usual way to avoid error messages, don't have errors. :D

Maybe you have heard of compilation errors that are not caused by errors in the code.

A while back builds on the build server would fail but on my development machine they would work. Turns out that the repository was checked out under a very long path and AutoIt cannot handle FileInstall calls with a source path longer than 254 chars.

Just today only the first build after restarting the build server would work, all following builds failed. Turns out that the Antivirus protection was the cause.

Now tell me how this could have been prevented.

Edited by PalorToff
Link to comment
Share on other sites

  • Developers

Would you consider adding such a feature to a future release?

I am not dealing with the core AutoIt3 stuff, just SciTE, tools and the installer.

Just submit an feature request to replace the MsgBox() for a STDOUT error message when in Commandlinemode.

Maybe it will be considered.

Jos

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

Maybe you have heard of compilation errors that are not caused by errors in the code.

I have heard of such things.

A while back builds on the build server would fail but on my development machine they would work. Turns out that the repository was checked out under a very long path and AutoIt cannot handle FileInstall calls with a source path longer than 254 chars.

Use short filenames instead of full names if there's a possibility of something like this happening. Or, don't put the repository in such a deep folder path.

Just today only the first build after restarting the build server would work, all following builds failed. Turns out that the Antivirus protection was the cause.

Now tell me how this could have been prevented.

Test your compiles against something like this once it happens. If it happens once, it will happen again, plan accordingly before committing the code to final usage. You know where it will fail, avoid that from happening by making sure that your AV software isn't affecting the compiles, put them in a folder that isn't scanned by it for instance.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • 9 months later...

hi,I have ever met the same problem. Here is my solution. It's simple and include 2step:

1 in autoIT script add some ConsoleWrite("1.begin run the a.exe" & @CRLF)

2 covert you autoit script test.au3 to test.exe file with console mode

3 in jenkins batch command direct call test.exe

when you run the jenkins job. All the log will be print. like "1.begin run the a.exe"

if met some problem the log can not print to end.

The drawback of this method is you still can not get the detail error infomation

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