• Set caption of terminal/console app

    From =?UTF-8?Q?Sebasti=C3=A1n_BASSANO?=@21:1/5 to All on Fri Apr 14 06:28:29 2023
    Hi, i'm trying to set the caption of a terminal app (Basic > Terminal App) without success.
    With the code below, the caption changes to My Caption but after the sleep go to the default Visual Objects terminal/console caption:

    FUNCTION Start()

    SetConsoleTitle(String2Psz("My Caption"))
    Sleep(1000)
    ? "Hello World"

    WAIT

    RETURN NIL

    Maybe i'm using the wrong function... Any hints?
    Thanks.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Norbert Kolb@21:1/5 to All on Sun Apr 16 06:21:01 2023
    Hello Sebasteán,
    you have to insert the function __InitConsole() before the call SetConsoleTitle. Then it should work.
    Kind regards
    Norbert

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Phil McGuinness@21:1/5 to All on Sun Apr 16 14:30:45 2023
    FUNCTION Start()

    ? "Hello World"

    SetConsoleTitle(String2Psz("My Caption"))
    Sleep(1000)

    //WAIT
    _Wait()

    RETURN NIL

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Sebasti=C3=A1n_BASSANO?=@21:1/5 to All on Mon Apr 17 05:13:05 2023
    El Sunday, April 16, 2023 a la(s) 6:30:47 PM UTC-3, Phil McGuinness escribió:
    FUNCTION Start()

    ? "Hello World"
    SetConsoleTitle(String2Psz("My Caption"))
    Sleep(1000)
    //WAIT
    _Wait()

    RETURN NIL

    Thank you both!
    The __InitConsole() line fixed the problem. You learn something new every day! As I couldn't get it to work I had created a Console App (instead of Terminal App) and with the Console object and the Title assignment I was able to achieve what I needed.
    Regards.

    Sebastián

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Phil McGuinness@21:1/5 to All on Tue Apr 18 15:33:15 2023
    Sebastion

    The reason I put the ? "hello world" before the SetConsoleTitle() is it calls __InitConsole() for you.
    You can read the source code in the SDK

    Phil

    Thank you both!
    The __InitConsole() line fixed the problem. You learn something new every day!
    As I couldn't get it to work I had created a Console App (instead of Terminal App) and with the Console object and the Title assignment I was able to achieve what I needed.
    Regards.

    Sebastián

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Sebasti=C3=A1n_BASSANO?=@21:1/5 to All on Wed Apr 19 04:53:12 2023
    El Tuesday, April 18, 2023 a la(s) 7:33:16 PM UTC-3, Phil McGuinness escribió:
    Sebastion

    The reason I put the ? "hello world" before the SetConsoleTitle() is it calls __InitConsole() for you.
    You can read the source code in the SDK

    Phil
    Thank you both!
    The __InitConsole() line fixed the problem. You learn something new every day!
    As I couldn't get it to work I had created a Console App (instead of Terminal App) and with the Console object and the Title assignment I was able to achieve what I needed.
    Regards.

    Sebastián

    Thanks Phil, your code worked too, in the end I used __InitConsole() for readability.

    Sebastián

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)