Sign in to follow this  
Followers 0
aiter

Console application - internal autoit error trap

8 posts in this topic

I am running my compiled application as a console application and need to prevent any internal errors from being displayed as a gui message, but rather display it as a console message only. An example of such an error would be a bad array reference (out of bounds).

Does anyone know how to do this or point me in the right direction?

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Thanks AutoBert.  Having looked at it briefly, it still returns the error as a dialog though and not console output.  Anything that returns an input response from my console application will cause it to hang because it is called within a framework that requires no input

eg from framework

Execute myapp capturing output

myapp is the compiled autoit script. As soon as myapp contains an input response, myapp hangs within the framework. Thus the reason for no dialogs required, just a console output message saying something like 'An error occurred'.

Edited by aiter
spelling

Share this post


Link to post
Share on other sites

I need to create a real console application.  That means no gui windows opening on internal errors.

I compile with the CUI checkbox checked, but when I run the program from CMD and there is a internal error like array out of bounds, I get a gui window detailing the error.

This is not a true console application then.

How do I create a real console application which shows errors written to STDOUT?

Any help appreciated.  This problem could kill all my work on my project.

Share this post


Link to post
Share on other sites

aiter,

Stick to just the one thread please.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

Share this post


Link to post
Share on other sites

Can this be added as a enhancement or bug for autoit please.

Compiled as CUI (console) means console output so output information to console and not as GUI output.

Alternatively have another checkbox for the information 'Error output to console only?'

Thank you amazing AutoIt developers in advance.

 

Share this post


Link to post
Share on other sites

How about wrapping the call to the program in c++ code ( or autoit code) which looks for that error window in a timer then if found, closes it and terminates the executable?

Before it closes the window maybe it can get the text from the window to output as a console message after it closes that error window and closes the exe.

Does this sound feasible and can anyone help with example code?

 

Share this post


Link to post
Share on other sites

Approach above worked. Thanks for all the help  Much appreciated.

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  
Followers 0

  • Similar Content

    • PClough
      Command line tools and StdIO redirection to a file
      By PClough
      Hi everyone!
      I want to programmatically alter the structure of a large number of PDF which have different sizes and orientation, and come from different generators. To do this I need to be able to capture different parameters describing their layout.  I use a console tool called pdfInfo (part of the xpdf public domain suite) which provides me with everything I need. The idea is first to run pdfInfo against my pdf file redirecting the console's output to a text file. And then to load and parse the text file to get the parameters I need.  The only problem is that no output file is ever created.  I've looked through the forums and saw a number of threads loosely related to this but none of the suggested solutions (like using StdoutRead) has worked for me. I should say maybe that I'm running Win10.
      So here's the code that doesn't work:
      $pdfInfo = "f:\pdfinfo.exe" $pdfTest = "f:\test.pdf" RunWait(chr(34) & $pdfInfo & " -box " & $pdfTest & " > f:\log.txt", "", @SW_HIDE) If you use in a console the command line: 
      f:\pdfinfo.exe -box f:\test.pdf > f:\log.txt
      it works perfectly.  But the piece of code above does not create the log.txt file. So any idea what I am doing wrong.  Thanks for any help!
       
       
    • TXTechie
      Run batch file from AutoIt script with output to console
      By TXTechie
      I normally launch things silently, but now I want to launch a batch (.cmd) file and have it run as normal displaying it's standard output to the user. Whether I use ShellExecuteWait or RunWait, the command prompt window is displayed, but the output is blank (although I know that the batch file is processing normally because it also produces a log file).
      If this is because AutoIt is re-directing the standard I/O of the batch file/console window, is there a way I can bypass the I/O redirection?
      Thanks,
      TXTechie
    • Simpel
      [Solved] SciTE no functions working
      By Simpel
      Hi,
      I updated to the last version. Since then a lot of functions are not working.  For instance expanding abbreviation. My au3abbrev.properties are correct and abbrev.properties are including both import lines. The abbreviation is red but won't expand. Neither with space nor Ctrl+B.
      Debug to msgbox and console not working, list functions, jump to function, open include too.
      SciTE Jump works. Block and box comment too.
      I have the feeling all functions especially for autoit are not working.
      Any help? Regards, Conrad
    • leke
      Keeping the console window open after execution has finished
      By leke
      I have an app that rips .ts files, but I'm having a problem seeing the the error message ffmpeg is displaying because the console window closes right after the message is rendered. 
      If I manually type the equivalent command from the command line, the .ts file rips ok, so I'm guessing it's not the command itself that is the issue. 
      How do I get the console window to remain open when running it through my autoIt app? 
      Code in question...
       Thanks
      Source code.exe
    • MyUM
      How to control a console application ?
      By MyUM
      Hello, I have a console application that works with command line arguments which I don't have its source code, & I want to create a GUI for it to make it easier.
      My problem is how to make the GUI application calls the console application & handle its output results to display it in the GUI application  with a progressbar or somthing ?
      Please look at the "X265 Command Line Options"
      https://x265.readthedocs.org/en/default/cli.html
      MeGUI is only a GUI app for the cli apps :
      http://sourceforge.net/p/meguimodproj/code/HEAD/tree/MeGUI Mod/
      Help me please