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

Home » Public Forums » archive » Help needed on calling an IDL procedure from the Linux command line
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
Help needed on calling an IDL procedure from the Linux command line [message #45268] Wed, 24 August 2005 13:59 Go to next message
Sanjay[1] is currently offline  Sanjay[1]
Messages: 1
Registered: August 2005
Junior Member
Hello all,

I have a question regarding calling IDL from a Linux command line. By
testing this out directly, I know that an IDL code can indeed be called
from the command line, e.g.:

$ idl test.pro

However, my limited experience indicates that this is not entirely
successful if "test" is a procedure, i.e. if it starts with the line:

PRO test, input

In this case I get the following error: "Programs can't be compiled
from a single statement mode". However, it seems not to matter too much
(at least for my purposes), since IDL keeps going onto the next line
anyway. But I don't know how to send the necessary variable "input" in
this case.

So I was wondering: is it possible to pass input variables via a
command line call? Can these be provided directly, or via an input
file? I contacted David Fanning, and he suggested that this group would
be a good source of information on this topic. Any help or information
that you have on this would be greatly appreciated.

Take care,
Sanjay
Re: Help needed on calling an IDL procedure from the Linux command line [message #45334 is a reply to message #45268] Mon, 29 August 2005 06:08 Go to previous message
K. Bowman is currently offline  K. Bowman
Messages: 330
Registered: May 2000
Senior Member
In article <11h1titocqh6p98@corp.supernews.com>,
Michael Wallace <mwallace.nospam@swri.edu.invalid> wrote:

>> So I was wondering: is it possible to pass input variables via a
>> command line call? Can these be provided directly, or via an input
>> file? I contacted David Fanning, and he suggested that this group would
>> be a good source of information on this topic. Any help or information
>> that you have on this would be greatly appreciated.
>
>
> The new IDL 6.2 includes support for command line arguments.

Now *there* is something useful in 6.2 :-)

Ken Bowman
Re: Help needed on calling an IDL procedure from the Linux command line [message #45340 is a reply to message #45268] Sat, 27 August 2005 16:25 Go to previous message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
> So I was wondering: is it possible to pass input variables via a
> command line call? Can these be provided directly, or via an input
> file? I contacted David Fanning, and he suggested that this group would
> be a good source of information on this topic. Any help or information
> that you have on this would be greatly appreciated.


The new IDL 6.2 includes support for command line arguments. You can
specify command line arguments with either the -arg or -args options.
For example:

$ idl test.pro -quiet -args arg1 arg2 arg3


Notice that the file test.pro must be a batch file rather than a
procedure or function. If it's not a batch file, you will get the error
message about programs not being able to be compiled in single statement
mode. Here are the contents of a very simple test.pro:

args = command_line_args()
print, n_elements(args)
print, args


And here's what I get when running it:

$ idl test.pro -quiet -args arg1 arg2 arg3
3
arg1 arg2 arg3


Typically, I will keep the batch file pretty small and use it only parse
the command line arguments. I then call the procedure or function that
does the real work. I split things up this so that I can call my core
code either from the command line or from another routine. My batch
programs usually look something like:

args = command_line_args()
; check args and set input and keyword values
really_nifty_idl_code(input1, input2, keyword = keyword1)

-Mike
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: postscript component selection
Next Topic: Re: Constrained Optimization routine

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

Current Time: Wed Oct 08 15:28:47 PDT 2025

Total time taken to generate the page: 0.00717 seconds