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

Home » Public Forums » archive » running main file from batch script ... in a loop
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
running main file from batch script ... in a loop [message #87678] Sat, 22 February 2014 08:17 Go to next message
antonella.garzilli is currently offline  antonella.garzilli
Messages: 2
Registered: February 2014
Junior Member
I was trying to run a main file from within a batch script. I have run it simply from the file, and it works, but if I try to call it from within a loop cycle I get a syntax error.

I do something like this:

n=10
for i=0, n do begin $
& .run main.pro $
& endfor


and main.pro can be something as easy as this:

print, 'hello'
end
Re: running main file from batch script ... in a loop [message #87679 is a reply to message #87678] Sat, 22 February 2014 08:29 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
antonella.garzilli@gmail.com writes:

> I was trying to run a main file from within a batch script. I have run it simply from the file, and it works, but if I try to call it from within a loop cycle I get a syntax error.
>
> I do something like this:
>
> n=10
> for i=0, n do begin $
> & .run main.pro $
> & endfor
>
>
> and main.pro can be something as easy as this:
>
> print, 'hello'
> end

Humm. Don't really know what to say, except this is "All Wrong!" What is
it, exactly, you are trying to do?

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: running main file from batch script ... in a loop [message #87680 is a reply to message #87678] Sat, 22 February 2014 08:33 Go to previous messageGo to next message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
There are a lot of problems with your simple example. One of them -- from the online help:

"Note: .RUN is an executive command. Executive commands can only be used at the IDL command prompt, not in programs."

Does something like the following work?

for i=0, 10 do yourProgram


If not, you would need to post more details about your batch script and your main program. They each have their own syntax.
Re: running main file from batch script ... in a loop [message #87681 is a reply to message #87679] Sat, 22 February 2014 09:22 Go to previous messageGo to next message
antonella.garzilli is currently offline  antonella.garzilli
Messages: 2
Registered: February 2014
Junior Member
Ahahahah

because batch files are a list of commands you would insert in the command prompt, I assumed that you could just put executive commands in a batch.
I solved my problem calling a pro from a main.

Anyway I should stop using IDL, it feels too much like programming in the 90s.


On Saturday, February 22, 2014 5:29:53 PM UTC+1, David Fanning wrote:
> writes:
>
>
>
>> I was trying to run a main file from within a batch script. I have run it simply from the file, and it works, but if I try to call it from within a loop cycle I get a syntax error.
>
>>
>
>> I do something like this:
>
>>
>
>> n=10
>
>> for i=0, n do begin $
>
>> & .run main.pro $
>
>> & endfor
>
>>
>
>>
>
>> and main.pro can be something as easy as this:
>
>>
>
>> print, 'hello'
>
>> end
>
>
>
> Humm. Don't really know what to say, except this is "All Wrong!" What is
>
> it, exactly, you are trying to do?
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: running main file from batch script ... in a loop [message #87683 is a reply to message #87681] Sat, 22 February 2014 10:07 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
antonella writes:

> because batch files are a list of commands you would insert in the
command prompt, I assumed that you could just put executive commands in
a batch.
> I solved my problem calling a pro from a main.
>
> Anyway I should stop using IDL, it feels too much like programming in the 90s.

Yes, *especially* the way you are using it! ;-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL reading tiff files
Next Topic: IDL license file

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

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

Total time taken to generate the page: 0.00741 seconds