Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Colored text in the Compile Output panel on Windows? (works on Linux)
Forum Updated to NodeBB v4.3 + New Features

Colored text in the Compile Output panel on Windows? (works on Linux)

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
5 Posts 2 Posters 152 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Robert Hairgrove
    wrote last edited by
    #1

    I am running a Windows batch file as a "Custom Process Step" after the regular build has finished. If there is an error, I would like to use my own highlighting (red on yellow, for example) so that it stands out in the flood of other text which is printed there.

    On Linux Ubuntu, it is a similar thing, but running a bash script and using the standard ANSI escape sequences. This works very nicely. It is supposed to work on Windows according to this site. But my escape sequences are mangled by Creator.

    I tried using various methods of escaping: '^[91;103m' does not work, neither does '^^[91;103m' (using delayed expansion), also not '\[91;103m', nor the literal '␛[91;103m' where I was able to copy and paste the ESC character from the web page linked in the above discussion thread.

    Is there any way of doing this on Windows 10 using CMD.EXE (not PowerShell)?

    1 Reply Last reply
    0
    • aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote last edited by
      #2

      Hi @Robert-Hairgrove,

      I've just tested that with Creator 17.0 and it works for me with the following example script (provided by https://ss64.com/nt/syntax-ansi.html)

      Can you please re-check? I think specifying the correct <ESC> is the problem.

      Regards

      Qt has to stay free or it will die.

      R 1 Reply Last reply
      4
      • aha_1980A aha_1980

        Hi @Robert-Hairgrove,

        I've just tested that with Creator 17.0 and it works for me with the following example script (provided by https://ss64.com/nt/syntax-ansi.html)

        Can you please re-check? I think specifying the correct <ESC> is the problem.

        Regards

        R Offline
        R Offline
        Robert Hairgrove
        wrote last edited by
        #3

        @aha_1980 Thanks for the link ... this works fine if I open the .BAT file from a command prompt.

        But did yiou actually run this in Qt Creator as a "Custom Process Step"? I get red text on a white background instead of yellow background. I think that Qt Creator (on Windows, at least) is overriding this somehow.

        1 Reply Last reply
        0
        • aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote last edited by
          #4

          @Robert-Hairgrove Yes I did and it works.

          But if you get red text, that sounds as if the output is from stderr and not from stdout. Errors are always printed in red.

          Regards

          Qt has to stay free or it will die.

          R 1 Reply Last reply
          2
          • aha_1980A aha_1980

            @Robert-Hairgrove Yes I did and it works.

            But if you get red text, that sounds as if the output is from stderr and not from stdout. Errors are always printed in red.

            Regards

            R Offline
            R Offline
            Robert Hairgrove
            wrote last edited by
            #5

            @aha_1980 Instead of just trying the codes in my own batch file, I changed the name from echoansi.txt to echoansi.BAT and set that as the custom process step, and it worked fine. However, when I tried to use the same codes in my own batch file, I noticed that some combinations of colors just won't work -- others are fine, but not what I need.

            For example, the Qt Creator output doesn't seem to recognize the codes for yellow (or bright yellow) background, nor for white or yellow text on a dark background -- although these look fine in the echoansi.BAT output.

            I need to look at this some more. At least it is nice to know that the endeavour isn't totally hopeless! Thanks for your input, @aha_1980!

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved