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

Home » Public Forums » archive » Re: passing parameters to .sav file in IDL VM
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: passing parameters to .sav file in IDL VM [message #68050] Tue, 22 September 2009 02:03
Prashanth is currently offline  Prashanth
Messages: 9
Registered: June 2009
Junior Member
Thanks Greg,

it works now. The problem was me :).

I thought the idlrt.exe is in the bin folder and I set the path to
bin. When I went through your message once again I realized that there
is one more folder bin.x86 where the file is. So, with a wrong path it
would never work. For my changeview program I was using a batch file
with the entire command and I was just executing the batch file. It
doesn't work this way with the arguments. It executed as if I am
typing changeview.sav at the command prompt. Not sure why? I have to
check the batch file issues, but thats another problem. I just typed
in the same full command at the command prompt and it worked fine
now.

Thank you all for the help.

Prashanth
Re: passing parameters to .sav file in IDL VM [message #68055 is a reply to message #68050] Mon, 21 September 2009 10:58 Go to previous message
Prashanth is currently offline  Prashanth
Messages: 9
Registered: June 2009
Junior Member
Hello Greg,

I tested the program you gave and it did not work on my machine. Maybe
it is a problem with the older versions of IDL?
I will try to find a system with 7.1 and check it again.

Thank you
Prashanth


On Sep 21, 4:24 pm, greg <greg.a...@googlemail.com> wrote:
>> You may be right. I can't get the Windows version to pick up
>> command arguments in the VM either. Have you talked to ITTVIS
>> support?
>
> Works for me in version 7.1 on Windows...
>
> pro test_vm_args
>    cla=command_line_args(count=count)
>    null=dialog_message([string(count),cla],/information)
> end
>
> IDL> save,/routines,file="D:\mydocs\tmp\test_vm_args.sav"
>
> C:\Program Files\ITT\IDL71\bin\bin.x86>idlrt -vm="D:\mydocs\tmp
> \test_vm_args.sav" -args "fred" "bert" "alf"
>
> I see all three strings in the window.
>
> regards,
> Greg
Re: passing parameters to .sav file in IDL VM [message #68064 is a reply to message #68055] Mon, 21 September 2009 07:24 Go to previous message
greg.addr is currently offline  greg.addr
Messages: 160
Registered: May 2007
Senior Member
> You may be right. I can't get the Windows version to pick up
> command arguments in the VM either. Have you talked to ITTVIS
> support?

Works for me in version 7.1 on Windows...

pro test_vm_args
cla=command_line_args(count=count)
null=dialog_message([string(count),cla],/information)
end

IDL> save,/routines,file="D:\mydocs\tmp\test_vm_args.sav"

C:\Program Files\ITT\IDL71\bin\bin.x86>idlrt -vm="D:\mydocs\tmp
\test_vm_args.sav" -args "fred" "bert" "alf"

I see all three strings in the window.

regards,
Greg
Re: passing parameters to .sav file in IDL VM [message #68066 is a reply to message #68064] Mon, 21 September 2009 06:19 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Prashanth writes:

> Since I am running it in VM, using print is not a good idea. I will
> try to check the result by displaying in a text widget. But that is
> not the point here. If it is getting into the if condition it only
> means the number of input parameters is less than 3. So, I am more
> worried about whats happening to my input parameters at the command
> line.

You may be right. I can't get the Windows version to pick up
command arguments in the VM either. Have you talked to ITTVIS
support?

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: passing parameters to .sav file in IDL VM [message #68069 is a reply to message #68066] Mon, 21 September 2009 05:25 Go to previous message
Prashanth is currently offline  Prashanth
Messages: 9
Registered: June 2009
Junior Member
Since I am running it in VM, using print is not a good idea. I will
try to check the result by displaying in a text widget. But that is
not the point here. If it is getting into the if condition it only
means the number of input parameters is less than 3. So, I am more
worried about whats happening to my input parameters at the command
line.

Thank you,
Prashanth

> I'd add a line "print,nparams" at a judicious point...
>
> regards,
> greg
Re: passing parameters to .sav file in IDL VM [message #68070 is a reply to message #68069] Mon, 21 September 2009 03:59 Go to previous message
greg.addr is currently offline  greg.addr
Messages: 160
Registered: May 2007
Senior Member
I'd add a line "print,nparams" at a judicious point...

regards,
greg
Re: passing parameters to .sav file in IDL VM [message #68071 is a reply to message #68070] Mon, 21 September 2009 01:55 Go to previous message
Prashanth is currently offline  Prashanth
Messages: 9
Registered: June 2009
Junior Member
Hello David,

The first part of the code goes like this

Pro ChangeView, file1,file2,file3

argsarray=command_line_args(count=nparams)

if nparams eq 3 then begin
file1=argsarray[0]
file2=argsarray[1]
file3=argsarray[2]
endif

if (nparams lt 3) then begin
file1 = DIALOG_PICKFILE(title='Select the first image')
file2 = DIALOG_PICKFILE(title='Select the second image')
file3 = DIALOG_PICKFILE(title='Select the change image')
endif

img1= read_envi_img(file1,lines=lines, samples=samples, bands=bands)
.
.
.

and I try to execute it using

idl -vm=changeview.sav -args "c:\june" "c:\october" "c:\june_oct"

This one opens the dialog window which means it is not recognizing the
input arguments. Is there something wrong with my procedure definition
"Pro changeview, file1,file2,file3" ?

Thank you
Prashanth

> An alternative explanation is that the variables
> are not set before you get to that part of the code.
> That seems entirely more likely to me. :-)
>
> The question really is, what are you *doing* with
> those parameters once you pick them up with
> Command_Line_Args? I'd guess, not putting them into
> your variables.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: passing parameters to .sav file in IDL VM [message #68076 is a reply to message #68071] Sun, 20 September 2009 19:39 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Prashanth writes:

> I have a condition where the program calls the dialog_pickfile to
> select the files when the number of parameters is less than 3. When I
> execute the command with the three arguments at the command line in
> DOS prompt, it still goes to the dialog_pickfile, which only means
> that the parameters are not recognized.

An alternative explanation is that the variables
are not set before you get to that part of the code.
That seems entirely more likely to me. :-)

The question really is, what are you *doing* with
those parameters once you pick them up with
Command_Line_Args? I'd guess, not putting them into
your variables.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: passing parameters to .sav file in IDL VM [message #68078 is a reply to message #68076] Sun, 20 September 2009 18:45 Go to previous message
Prashanth is currently offline  Prashanth
Messages: 9
Registered: June 2009
Junior Member
I have a condition where the program calls the dialog_pickfile to
select the files when the number of parameters is less than 3. When I
execute the command with the three arguments at the command line in
DOS prompt, it still goes to the dialog_pickfile, which only means
that the parameters are not recognized.

Prashanth
Re: passing parameters to .sav file in IDL VM [message #68079 is a reply to message #68078] Sun, 20 September 2009 15:49 Go to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Sep 20, 5:21 pm, Prashanth <prashanthred...@gmail.com> wrote:
> Just forgot to mention.
>
> I have the part to handle the command line arguments as
>
> argsarray=command_line_args(count=nparams)
>
> if nparams eq 3 then begin
> file1=argsarray[0]
> file2=argsarray[1]
> file3=argsarray[2]
> endif

That should work - what do you mean by "it doesn't work". What is
happening?
Re: passing parameters to .sav file in IDL VM [message #68080 is a reply to message #68079] Sun, 20 September 2009 15:21 Go to previous message
Prashanth is currently offline  Prashanth
Messages: 9
Registered: June 2009
Junior Member
Just forgot to mention.

I have the part to handle the command line arguments as

argsarray=command_line_args(count=nparams)

if nparams eq 3 then begin
file1=argsarray[0]
file2=argsarray[1]
file3=argsarray[2]
endif
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Breakpoints Missing in IDL 7.1?
Next Topic: Re: Sorting (big) int array: Eliminate for loop

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

Current Time: Wed Oct 08 15:23:03 PDT 2025

Total time taken to generate the page: 0.00541 seconds