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

Home » Public Forums » archive » Re: Passing Batch File Names
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: Passing Batch File Names [message #62286 is a reply to message #62284] Tue, 02 September 2008 10:15 Go to previous messageGo to previous message
Trae is currently offline  Trae
Messages: 23
Registered: May 2007
Junior Member
No. It fact, it can lead to segmentation faults.

You could easily test the string for '$' and then combine lines as
needed.

However, for this application, a series of variables are being
defined. It is easier to keep 1 line per command than try to make
anything to tricky. Of course, if you have time to play you can make
this procedure as general as you want.

-Trae

On Sep 2, 12:57 pm, pgri...@gmail.com wrote:
> Does it work with multiline statements such as
>
> for i=0,10 do begin &$
> print,i &$
> endfor
>
> which are legal for batch files?
>
> Ciao,
> Paolo
>
> Trae wrote:
>> Just in case another poor soul needs this and searches the group, here
>> are the lines of code that made it work. NB: EXECUTE only accepts
>> scalars as an input. Bogus.
>
>> First define a batch file named batch_test.pro with the commands
>
>> a=5
>> b=6
>> c=sin(!dpi/4.)
>
>> Now here are the commands to read and execute it.
>
>> file='batch_test.pro'
>
>> openr, lun, file, /GET_LUN
>> var_arr=''
>> ;while not eof do begin
>
>> WHILE ~ EOF(lun) DO BEGIN
>> line=''
>> READF,lun , line
>> var_arr=[var_arr,line]
>> ENDWHILE
>> FREE_LUN, lun
>> var_arr=var_arr[1:*]
>
>> for i=0ul,n_elements( var_arr) -1ul do result=execute(var_arr[i])
>
>> END
>
>> So you can define the variable 'file' anyway you want and it can have
>> as many or as few commands as you need.
>
>> Thanks for the help everyone!
>
>> I'm off to be quite pleased with myself for awhile! :)
>
>> Cheers,
>> -Trae
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Singular Value Decomposition in 3 Dimensions
Next Topic: FFT and ROTATE

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

Current Time: Wed Oct 08 19:57:02 PDT 2025

Total time taken to generate the page: 0.00493 seconds