Capturing stdoutput [message #11636] |
Thu, 21 May 1998 00:00  |
Bernard Puc
Messages: 65 Registered: January 1998
|
Member |
|
|
Hello,
I am looking for ideas on how to implement the following: I have a
widget application and I want to display whatever output various
procedures/functions usually write to the output log window in a text
window in the application. Any hints are welcome.
-Bernard Puc
puc@gsfc.nasa.gov
|
|
|
Re: Capturing stdoutput [message #11818 is a reply to message #11636] |
Fri, 22 May 1998 00:00  |
J.D. Smith
Messages: 214 Registered: August 1996
|
Senior Member |
|
|
Bernard Puc wrote:
>
> Hello,
> I am looking for ideas on how to implement the following: I have a
> widget application and I want to display whatever output various
> procedures/functions usually write to the output log window in a text
> window in the application. Any hints are welcome.
>
> -Bernard Puc
> puc@gsfc.nasa.gov
This points to the need I see for IDL to contain a general *information* catching
mechanism. I.e., I mean that:
message,'This message',/INFORMATIONAL
would send a signal, not of an error, but of an info type, which could be caught
with catch.
Then, e.g., we simply could say:
catch,info,/INFORMATIONAL
if info ne 0 then widget_control,log,set_value=!INFO_STRING
and redirect all info into our widget. This way, a program run on the command line
would give info on the command line, but we could easily put that info anywhere else
if we so choose.
JD
--
J.D. Smith |*| WORK: (607) 255-5842
Cornell University Dept. of Astronomy |*| (607) 255-4083
206 Space Sciences Bldg. |*| FAX: (607) 255-5875
Ithaca, NY 14853 |*|
|
|
|
Re: Capturing stdoutput [message #11826 is a reply to message #11636] |
Fri, 22 May 1998 00:00  |
Alex Schuster
Messages: 124 Registered: February 1997
|
Senior Member |
|
|
Bernard Puc wrote:
> I am looking for ideas on how to implement the following: I have a
> widget application and I want to display whatever output various
> procedures/functions usually write to the output log window in a text
> window in the application. Any hints are welcome.
Any hints? Okay, then you could do a find and replace in each .pro file
your program needs, and replace print with printlog where printlog is a
procedure like this:
pro printlog var1, var2, var3, var4, var5, var6, var7, var8, var9, var10
text = ''
for i = 1, n_params() do $
foo = execute( 'text=text+string(var' + strtrim( i, 1 ) + ')' )
widget_control, log_id, /append, set_value=text
end
I concatenates all the given parameters to one string, and appends it in
the log widget. This worked fine for me, but if you cannot modify the
routines, or if they are written in C/Fortran, it wouldn't help you.
You can redirect the complete output by starting IDL via 'idl >
logfile', but you cannot access this file in IDL because it has be be
closed first.
Alex
--
Alex Schuster Wonko@weird.cologne.de PGP Key available
alex@pet.mpin-koeln.mpg.de
|
|
|