Menu

#290 Detect batch mode (or console mode) in script

None
closed
nobody
None
5
2023-12-12
2023-12-01
No

Hello,

TLDR: I will appreciate your help in figuring out how to detect (using gnuplot script commands) whether a gnuplot script runs in batch mode or has been loaded from the gnuplot console.

On Windows, the installer associates gnuplot with the file associations .gp . Thus I can save gnuplot commands to a .gp file and by double clicking this script file, a graph window opens (but no console). That's what I call "batch mode".

Alternatively, those script files can be loaded on the gnuplot console using the "load" command (or dragging&dropping them on the console window).

However, when running in batch mode, the terminal "qt" requires the command "pause mouse close" at the end of the batch file to keep the graph window interactive, see bug #2600

When this script file is loaded from the gnuplot console, however, the "pause mouse close" prevents interactivity on the gnuplot console until the graph window is closed.

Thus I'd like to conditionally execute this pause mouse close" command when the batch file is loaded in batch mode only.

Is this possible?
Thanks.
Daniel

Discussion

  • Ethan Merritt

    Ethan Merritt - 2023-12-01

    The documentation says:

    If the current terminal supports mousing, then pause mouse will terminate
    on either a mouse click or on ctrl-C. For all other terminals, or if mousing
    is not active, pause mouse is equivalent to pause -1.

    I don't use Windows so I can't say for sure whether ctrl-C works as stated. Did you try?

     
    😄
    1
  • Daniel Dan K.

    Daniel Dan K. - 2023-12-12

    Thanks, Ethan, pressing ctrl-C on the console does the trick.

     
  • Ethan Merritt

    Ethan Merritt - 2023-12-12
    • status: open --> closed
    • Group: -->
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.