comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Q: Calling .PRO from a program
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Q: Calling .PRO from a program [message #11647] Wed, 20 May 1998 00:00
Martin Fuhrer is currently offline  Martin Fuhrer
Messages: 3
Registered: April 1998
Junior Member
Thanks David, you gave me the solution!

Cheers,
Martin

PS. Your excellent book is on my desk ...
Re: Q: Calling .PRO from a program [message #11650 is a reply to message #11647] Wed, 20 May 1998 00:00 Go to previous message
Martin Schultz is currently offline  Martin Schultz
Messages: 515
Registered: August 1997
Senior Member
Martin Fuhrer wrote:
>
> Hi idl experts
[...]
> 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
> ..
>
> The program crashes then with the following message:
> IDL>EM_GUI
> %EM: Incorrect number of arguments.
> %Execution halted at: ...
>

Since you named your "keyword" kwd1, I have the suspicion that you
actually want to pass a keyword to EM, not a parameter. As Reimar
noted, it will probably be a matter of the definition of EM. My guess is

pro em,kwd1=kwd1

Then you will have to pass kwd1 as

em,kwd1=kwd1 *not* em,kwd1

I would recommend the online documentation: section on parameter passing
and keywords.

Martin.

--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Earth&Planetary Sciences, Harvard University
109 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA

phone: (617)-496-8318
fax : (617)-495-4551

e-mail: mgs@io.harvard.edu
Internet-homepage: http://www-as.harvard.edu/people/staff/mgs/
------------------------------------------------------------ -------
Re: Q: Calling .PRO from a program [message #11660 is a reply to message #11647] Tue, 19 May 1998 00:00 Go to previous message
davidf is currently offline  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/
Re: Q: Calling .PRO from a program [message #11661 is a reply to message #11660] Tue, 19 May 1998 00:00 Go to previous message
R. Bauer is currently offline  R. Bauer
Messages: 137
Registered: November 1996
Senior Member
Martin Fuhrer wrote:

> Hi idl experts
> 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
> ..
>
> The program crashes then with the following message:
> IDL>EM_GUI
> %EM: Incorrect number of arguments.
> %Execution halted at: ...
>
> One of the grizzly facts is that I don't know where the error message is
> coming from because in EM.PRO there is no such message implemented!
>
> Help about the keyword reveals the follwing information:
> IDL> help, kwd1
> KWD1 STRING = 'HCOPY=0'
>
> An hints or suggestions are very much appreciated by
> martin.fuhrer@computer.org


There is too much unknown.

How did you declare em.


pro em,in_var
end

or

pro em
end

or

;pro em,in_var
end



Only first definition will accept a submitted value.



--
R.Bauer

Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Scroll bars in scalable draw widgets
Next Topic: Re: Insight and HDF files

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:39:44 PDT 2025

Total time taken to generate the page: 0.01058 seconds