Re: Q: Calling .PRO from a program [message #11660 is a reply to message #11647] |
Tue, 19 May 1998 00:00   |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Martin Fuhrer (martin.fuhrer@computer.org) writes:
> I'm running IDL V5.0.2 WIN32 under WIN95 and I am writing a
> widget-based program. At some point my program calls another IDL program
> with keywords and parameters stored in local variables. I expected the
> program to behave like:
> IDL> myDirectory = 'C:\RSI\myData'
> IDL>ImageOut, myDirectory
> but it won't!
>
> For details see below:
> ..
> If (cpy eq 0) Then Begin
> kwd1 = 'HCOPY=0'
> ..
> EndIf Else Begin
> kwd1 = 'HCOPY=1'
> ..
> EndElse
> ;call other idl program (EM.PRO) with keyword now
> EM, kwd1
Programs should be called in widget programs exactly
the way they are called on the IDL command line. For
example, on the IDL command line you call your EM
program like this:
IDL> EM, HCOPY=1
You should do the same in your widget code:
If (cpy eq 0) Then EM, HCOPY=0 Else EM, HCOPY=1
It is possible to create keywords as strings, but then
you need to "execute" the command string, like this:
command = 'EM'
keyword = 'HCOPY=1'
ok = EXECUTE(command + ',' + keyword)
You can find more information about things like this
on my web page or (especially) in my IDL Programming
Techniques book.
Cheers,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|