Hello!
There is no FGLPROFILE entry to run in TUI mode, only the FGLGUI=0 environment variable.
Setting FGLGUI=0 before starting your batch programs may help to prevent GUI connection errors.
However, even in TUI mode, if the code starts to use some UI instructions, fglrun can switch the terminal in raw mode, and TTY escape sequences can be generated, that would corrupt the output of your batch program (if you want to redirect into a file for ex)
Batch program should only use simple DISPLAY commands, and base.Channel.openFile("<stderr>","w") to write to stderr...
So the best solution to me is to avoid any instruction that is related to UI.
Maybe you want to isolate all you batch / processing code in dedicated .4gl modules, and write all the UI instructions in other modules.
When starting a batch program from another program, consider also RUN .. IN FORM/LINE MODE option, see:
https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_programs_RUN.htmlSeb