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

Home » Public Forums » archive » Re: IDL, scripts and command line arguments?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL, scripts and command line arguments? [message #29991 is a reply to message #29990] Sun, 31 March 2002 09:22 Go to previous messageGo to previous message
Ken Mankoff is currently offline  Ken Mankoff
Messages: 158
Registered: February 2000
Senior Member
On 27 Mar 2002, Michael A. Miller wrote:
> Does anyone have any suggestions on ways to trick IDL into
> getting access to command line arguments (argv- and argc-like
> functionality)? The only trick I've come up with so far is to
> write a script in <scripting-language-of-choice> that writes an
> idl procedure with the parameters hard coded into it and then
> executes it. It's not very pretty though and I wonder if there
> are any other possibilities...

That is how I managed to do it, but I like to think of it as
'very purty' as opposed to 'not very pretty'.

Here is my script. I name it "idl_argv.pl", and here are some examples
of how to call it (from the unix prompt):

./idl_argv.pl
./idl_argv.pl 's = "a silly string"'
./idl_argv.pl 'for i=0,10 do print, i'
./idl_argv.pl 'foo=42 & help, foo & plot, indgen(foo)'
./idl_argv.pl 'pi=3.14159D & almost_pi = 4 ; spaces and comments!'

Here is the script:
----------------------------------------
#! /usr/bin/perl

$input = $ARGV[0];
@list = split( /&/, $input );
$uniq = $$;

open( IDL_FILE, ">idl.$$.pro" );
for ($i=0; $i<=$#list; $i++)
{ print IDL_FILE "$list[$i]\n"; }
close( IDL_FILE );

system( "idl idl.$$.pro" );
system( "/bin/rm idl.$$.pro" );
exit(0);
-----------------------------------------

Is this even close to what you were trying to do?

-k.
--
Kenneth Mankoff
LASP://303.492.3264
http://lasp.colorado.edu/~mankoff/
http://lasp.colorado.edu/snoe/
http://lasp.colorado.edu/marsrobot/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: idlde on mswin vs unix
Next Topic: map_grid and western longitudes

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

Current Time: Sat Oct 11 01:56:11 PDT 2025

Total time taken to generate the page: 0.00630 seconds