Fanning Software Consulting

Running from the Workbench

Facebook RSS Google+

QUESTION: Is there a way to tell if IDL has been launched from the IDL Workbench or Development Environment (IDLDE) as opposed to from a terminal? I ask because if a routine is launched from within the IDLDE I would like it to display some information via a GUI. But, if it were launched via a terminal window, then I would like the information printed out at the terminal.

ANSWER: This answer come from Wayne Landsman, of NASA Astronomy Library fame.

Examine the output of the IsAGui field of FStat, with a -1 as the argument. If the routine is launched from the Workbench, it will return a 1. If it is launched from a terminal, it will return a 0. Note that Windows computers return a 1 under both scenarios.

   IDL> Print, (FStat(-1,)).IsAGui
        1

Version of IDL used to prepare this article: IDL 8.2.

Written: 10 January 2013