+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: Read console output from

  1. #1

    Default Read console output from

    Is there a way to capture the output written to the console from a Run program statement?

  2. #2
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Read console output from

    Mark,

    "Run Command Line" is a wrapper around the CreateProcess API. In Windows, you always use ">" to redirect output from a console app to a text file.

    Hope this helps.

    Friedrich
    Attached Images Attached Images  

  3. #3

    Default Re: Read console output from

    And then the text file can be read back into SetupBuilder?

  4. #4
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Read console output from

    Yes. For example, via the "Handle Text File Operation..." script function.

    Friedrich

  5. #5

    Default Re: Read console output from

    Quote Originally Posted by linder View Post
    Yes. For example, via the "Handle Text File Operation..." script function.

    Friedrich
    That seems to read it one line at a time. Is there any way to just read the whole text file at once?

  6. #6
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Read console output from

    Just LOOP through the file and then process the lines. Not sure what you are trying to do with the output result. Are you looking for specific error messages from the console application?

    Friedrich

  7. #7

    Default Re: Read console output from

    Kind of, we're just looking to display the contents to the user. We have a secondary install as part of our application and we found that when the secondary installer fails, it dumps the details of the error out to the console. So, we'd like to grab that and display it so we have some idea what went wrong. All we get right now is the not-helpful error code number returned back to SetupBuilder.

  8. #8
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Read console output from

    Okay. Then LOOP through the file and process the lines (look for error codes or something like that; e.g. using "Handle String Operations..."). Or just display the result.txt as a whole (using notepad or another default app).

    Friedrich

  9. #9

    Default Re: Read console output from

    Ok, that all works. Now the issue is that "Run Command Line" always returns error code 0, even if the installer that was run reported an error. Is this something that I'll have to handle manually?

  10. #10
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Read console output from

    Mark,

    It returns "0" because the executable started without any problem (operation succeeded).

    Return Values - If the function succeeds, the %_SB_ERRORCODE% return value is zero.

    To catch the exit code (if the application returns any; not all do), you have to use "Run Program...".

    BTW, if you need a demo project, just let me know.

    Friedrich

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •