Author Topic: Scirpt: change font color in ProcessConsole  (Read 354 times)

Offline Herbert_W

  • PixInsight Addict
  • ***
  • Posts: 181
    • View Profile
    • Skypixels - Astrophotography by Herbert Walter
Scirpt: change font color in ProcessConsole
« on: 2018 January 05 10:25:01 »
Hi,

within a Script it is possible to change the style of a font in the ProcessConsole with <i>, <b>, ...
e.g. Console.writeln("<b> text bold </b>");

Is it possible to change the fontcolor as well?

Thank you and best regards!
Herbert, Austria

Offline Herbert_W

  • PixInsight Addict
  • ***
  • Posts: 181
    • View Profile
    • Skypixels - Astrophotography by Herbert Walter
Re: Scirpt: change font color in ProcessConsole
« Reply #1 on: 2018 January 05 11:04:23 »
Answer:

function main()
{
Console.writeln( "Console.writeln" ); //white
Console.criticalln( "Console.criticalln" ); //red
Console.noteln( "Console.noteln" ); //green
Console.warningln( "Console.warningln" ); //magenta
Console.writeln( "Test end" ); //white
}

main();

Thank you to Hartmut Bornemann!

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 6091
    • View Profile
    • http://pixinsight.com/
Re: Scirpt: change font color in ProcessConsole
« Reply #2 on: 2018 February 05 09:43:06 »
For completeness, besides those standardized console writing methods, the PixInsight console supports most of the standard ANSI escape codes, a large set of control tags, and a special HTML mode. You have all of this documented in the PCL documentation for the Console C++ class. The same information is perfectly valid for JavaScript.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline FunTomas

  • PixInsight Addict
  • ***
  • Posts: 134
    • View Profile
    • Astrofoto.sk
Re: Script: change font color in ProcessConsole
« Reply #3 on: 2018 February 06 19:52:03 »
Sorry Juan, but I must react to your post. PCL documentation (still incomplete) is not helpful for JavaScript. Here is simple example:
This is part of your code (AutoSTF.js)
Code: [Select]
function main()
{
   var images = ImageWindow.windows;
   .
   .
   .
}

main();
From where can I know, that ImageWindow has property windows? https://pixinsight.com/developer/pcl/doc/html/classpcl_1_1ImageWindow.html
Why can I write ImageWindow without defining main UIObject? (from PCL Doc...  "...UIObject is the root base class of all PCL classes...").

Another example - I try to create simple script to write image properties (width, height) into console.
Code: [Select]
var window = ImageWindow.activeWindow;   // in PCL documentation defined as ActiveWindow() - method and UpperCase first letter
var view = window.currentView;                   // CurrentView() - same as above
var h = view.height;                                    // Height() - same as above

I got undefined property view.height as result of this simple script.

Of course it's possible to read scripts from other authors, but it's not easy to understand it using PCL doc help.

It will be very useful to write simple PixInsight reference about javascript objects, their methods and properties. It will help us to start programming (and understanding) PixInsight  utilities in this language.