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

Home » Public Forums » archive » run .sav file with -args
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
run .sav file with -args [message #73511] Sun, 14 November 2010 17:22 Go to next message
Truong Le is currently offline  Truong Le
Messages: 42
Registered: September 2010
Member
Hi All,

I have created a procedure that I can execute from a window command
line
for example,

idlde sayhello -args param1 param2

when i ran this procedure using the .sav file it didn't work, for
example

idl -vm = sayhello.sav -args param1 param2


It complains that the sayhello.sav function/procedure is undefined
but the sayhello.sav file does exist. Please let me know if the way I
execute my
procedure using the .sav file is correct.

Thanks!
Re: run .sav file with -args [message #73626 is a reply to message #73511] Mon, 15 November 2010 19:59 Go to previous message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
On 11/15/10 10:03 PM, Truong Le wrote:

>
> Hi Ben,
>
> I have successfully executed the example above in the window
> environment and
> so I set out to build a more complicated procedures that I need to
> create for
> my work. After I build my .sav file from using idlde and ran the .sav
> file
> using idlrt -vm=filename.sav -args param1 param2 ...
>
> I get the attempt to call undefined procedure/function:'filename'
> message.
> The .sav file is in the directory. Please let me know what I did
> wrong.

Hi,

I suspect that this is *not* an issue with the Virtual Machine. To get
the most useful help from the list, you should post the complete error
message - exactly as IDL prints it.

Without more info we can only guess, and my guess is that somewhere you
have a variable called "filename" that you are indexing with parentheses
instead of square brackets.

filename(i) <-- IDL might think filename is a function
filename[i] <-- an element of a variable 'filename'


But, then again, you might actually have a routine called 'filename'
that didn't get compiled and stuffed into the save file, but,
nonetheless, gets called by the code that did make it into the save file.


Ben
Re: run .sav file with -args [message #73627 is a reply to message #73511] Mon, 15 November 2010 19:45 Go to previous message
Truong Le is currently offline  Truong Le
Messages: 42
Registered: September 2010
Member
On Nov 15, 10:43 pm, David Fanning <n...@dfanning.com> wrote:
> Truong Le writes:
>> I thought you can name the .sav file whatever you want to.
>
> Yes, as long as it is the name of the program you are trying
> to run. :-)
>
> 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.")

okay, thanks guys! it works!
Re: run .sav file with -args [message #73628 is a reply to message #73511] Mon, 15 November 2010 19:43 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Truong Le writes:

> I thought you can name the .sav file whatever you want to.

Yes, as long as it is the name of the program you are trying
to run. :-)

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: run .sav file with -args [message #73629 is a reply to message #73511] Mon, 15 November 2010 19:31 Go to previous message
Truong Le is currently offline  Truong Le
Messages: 42
Registered: September 2010
Member
On Nov 15, 10:09 pm, Paulo Penteado <pp.pente...@gmail.com> wrote:
> On Nov 16, 1:03 am, Truong Le <truong...@gmail.com> wrote:
>
>> I have successfully executed the example above in the window
>> environment and
>> so I set out to build a more complicated procedures that I need to
>> create for
>> my work. After I build my .sav file from using idlde and ran the .sav
>> file
>> using idlrt -vm=filename.sav -args param1 param2 ...
>
>> I get the attempt to call undefined procedure/function:'filename'
>> message.
>> The .sav file is in the directory. Please let me know what I did
>> wrong.
>
> Does 'filename.sav' contain a procedure named 'filename'?

I thought you can name the .sav file whatever you want to.
Re: run .sav file with -args [message #73630 is a reply to message #73511] Mon, 15 November 2010 19:28 Go to previous message
Truong Le is currently offline  Truong Le
Messages: 42
Registered: September 2010
Member
On Nov 15, 10:09 pm, Paulo Penteado <pp.pente...@gmail.com> wrote:
> On Nov 16, 1:03 am, Truong Le <truong...@gmail.com> wrote:
>
>> I have successfully executed the example above in the window
>> environment and
>> so I set out to build a more complicated procedures that I need to
>> create for
>> my work. After I build my .sav file from using idlde and ran the .sav
>> file
>> using idlrt -vm=filename.sav -args param1 param2 ...
>
>> I get the attempt to call undefined procedure/function:'filename'
>> message.
>> The .sav file is in the directory. Please let me know what I did
>> wrong.
>
> Does 'filename.sav' contain a procedure named 'filename'?

no
Re: run .sav file with -args [message #73631 is a reply to message #73511] Mon, 15 November 2010 19:09 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Nov 16, 1:03 am, Truong Le <truong...@gmail.com> wrote:
> I have successfully executed the example above in the window
> environment and
> so I set out to build a more complicated procedures that I need to
> create for
> my work. After I build my .sav file from using idlde and ran the .sav
> file
> using idlrt -vm=filename.sav -args param1 param2 ...
>
> I get the attempt to call undefined procedure/function:'filename'
> message.
> The .sav file is in the directory. Please let me know what I did
> wrong.

Does 'filename.sav' contain a procedure named 'filename'?
Re: run .sav file with -args [message #73632 is a reply to message #73511] Mon, 15 November 2010 19:03 Go to previous message
Truong Le is currently offline  Truong Le
Messages: 42
Registered: September 2010
Member
On Nov 15, 8:45 pm, Truong Le <truong...@gmail.com> wrote:
> On Nov 15, 7:16 pm, Truong Le <truong...@gmail.com> wrote:
>
>
>
>> On Nov 15, 6:24 pm, Ben Tupper <ben.bigh...@gmail.com> wrote:
>
>>> On 11/15/10 5:42 PM, Truong Le wrote:
>
>>>> On Nov 15, 3:31 pm, Truong Le<truong...@gmail.com>  wrote:
>
>>>> what do I need to modify to run the .sav file from the window
>>>> environment.
>>>> I know that window doesn't run idl but idlde so any help is
>>>> appreciated.
>
>>>> Thanks
>
>>> Hi,
>
>>> Look at the online docs for "Command Line Options for IDL Startup" (in
>>> IDL 7 help it is buried in "IDL Users' Guides > Using IDL > Introducing
>>> IDL") - scroll to the bottom for Windows specific info regarding this.
>
>>> Cheers,
>>> Ben
>
>> Okay, I ran the above example from the window command line but it
>> doesn't print the expected
>> result. It ran through the process that I seen when I ran it under
>> unix. Under the unix I seen the
>> words Hello and World printed out but not when I ran under the window
>> environment. It didn't give
>> any error message so I am at a lost.
>
>> idlrt -vm=cmd_args.sav -args Hello World
>
> okay, I find out that print, var won't work in the virtual machine
> under windows. I have to use printf.

Hi Ben,

I have successfully executed the example above in the window
environment and
so I set out to build a more complicated procedures that I need to
create for
my work. After I build my .sav file from using idlde and ran the .sav
file
using idlrt -vm=filename.sav -args param1 param2 ...

I get the attempt to call undefined procedure/function:'filename'
message.
The .sav file is in the directory. Please let me know what I did
wrong.

Thanks
Re: run .sav file with -args [message #73633 is a reply to message #73511] Mon, 15 November 2010 17:45 Go to previous message
Truong Le is currently offline  Truong Le
Messages: 42
Registered: September 2010
Member
On Nov 15, 7:16 pm, Truong Le <truong...@gmail.com> wrote:
> On Nov 15, 6:24 pm, Ben Tupper <ben.bigh...@gmail.com> wrote:
>
>
>
>> On 11/15/10 5:42 PM, Truong Le wrote:
>
>>> On Nov 15, 3:31 pm, Truong Le<truong...@gmail.com>  wrote:
>
>>> what do I need to modify to run the .sav file from the window
>>> environment.
>>> I know that window doesn't run idl but idlde so any help is
>>> appreciated.
>
>>> Thanks
>
>> Hi,
>
>> Look at the online docs for "Command Line Options for IDL Startup" (in
>> IDL 7 help it is buried in "IDL Users' Guides > Using IDL > Introducing
>> IDL") - scroll to the bottom for Windows specific info regarding this.
>
>> Cheers,
>> Ben
>
> Okay, I ran the above example from the window command line but it
> doesn't print the expected
> result. It ran through the process that I seen when I ran it under
> unix. Under the unix I seen the
> words Hello and World printed out but not when I ran under the window
> environment. It didn't give
> any error message so I am at a lost.
>
> idlrt -vm=cmd_args.sav -args Hello World

okay, I find out that print, var won't work in the virtual machine
under windows. I have to use printf.
Re: run .sav file with -args [message #73640 is a reply to message #73511] Mon, 15 November 2010 16:16 Go to previous message
Truong Le is currently offline  Truong Le
Messages: 42
Registered: September 2010
Member
On Nov 15, 6:24 pm, Ben Tupper <ben.bigh...@gmail.com> wrote:
> On 11/15/10 5:42 PM, Truong Le wrote:
>
>> On Nov 15, 3:31 pm, Truong Le<truong...@gmail.com>  wrote:
>
>> what do I need to modify to run the .sav file from the window
>> environment.
>> I know that window doesn't run idl but idlde so any help is
>> appreciated.
>
>> Thanks
>
> Hi,
>
> Look at the online docs for "Command Line Options for IDL Startup" (in
> IDL 7 help it is buried in "IDL Users' Guides > Using IDL > Introducing
> IDL") - scroll to the bottom for Windows specific info regarding this.
>
> Cheers,
> Ben

Okay, I ran the above example from the window command line but it
doesn't print the expected
result. It ran through the process that I seen when I ran it under
unix. Under the unix I seen the
words Hello and World printed out but not when I ran under the window
environment. It didn't give
any error message so I am at a lost.

idlrt -vm=cmd_args.sav -args Hello World
Re: run .sav file with -args [message #73642 is a reply to message #73511] Mon, 15 November 2010 15:24 Go to previous message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
On 11/15/10 5:42 PM, Truong Le wrote:
> On Nov 15, 3:31 pm, Truong Le<truong...@gmail.com> wrote:

>
> what do I need to modify to run the .sav file from the window
> environment.
> I know that window doesn't run idl but idlde so any help is
> appreciated.
>
> Thanks
Hi,

Look at the online docs for "Command Line Options for IDL Startup" (in
IDL 7 help it is buried in "IDL Users' Guides > Using IDL > Introducing
IDL") - scroll to the bottom for Windows specific info regarding this.

Cheers,
Ben
Re: run .sav file with -args [message #73643 is a reply to message #73511] Mon, 15 November 2010 14:42 Go to previous message
Truong Le is currently offline  Truong Le
Messages: 42
Registered: September 2010
Member
On Nov 15, 3:31 pm, Truong Le <truong...@gmail.com> wrote:
> On Nov 15, 12:27 pm, Ben Tupper <ben.bigh...@gmail.com> wrote:
>
>
>
>> On 11/15/10 11:53 AM, Truong Le wrote:
>
>>> On Nov 14, 8:42 pm, Truong Le<truong...@gmail.com>  wrote:
>>>> On Nov 14, 8:28 pm, David Fanning<n...@dfanning.com>  wrote:
>
>>>> > Truong Le writes:
>>>> >> It complains that the sayhello.sav  function/procedure is undefined
>>>> >> but the sayhello.sav file does exist. Please let me know if the way I
>>>> >> execute my
>>>> >> procedure using the .sav file is correct.
>
>>>> > Have you tried specifying the complete path to the file?
>
>>>> > 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.")
>
>>>> when I type
>
>>>> idl sayhello.sav -args param1 param2
>
>>>> there is a directory widget the pop-up which allows me to select the
>>>> sayhello.sav,
>>>> so I am sure the path is correct.
>
>>> I read other posting and realize that I can't run the .sav file with -
>>> args.
>>> Here is an example what I try to accomplish.
>
>>> I have a procedure that takes command line arguments as follow:
>
>>> pro test
>
>>>     ; parse the parameters
>>>     numArgs = 2
>>>     par = COMMAND_LINE_ARGS(COUNT=numArgs)
>
>>>     print, par[0]
>>>     print, par[1]
>>> end
>
>>> when I ran this procedure from the dos command line using idlde by
>>> doing
>>> idlde -args hello hi
>
>>> and execute the test procedure it print both "hello" and "hi"
>
>>> I ran the idlde build project and this creates a test.sav file
>
>>> I need to know how I can execute idl -vm = test.sav from the unix and
>>> passing
>>> in the two arguments that I need. Is this task not possible?
>
>>> Thanks
>
>> Hi,
>
>> I suspect that the spaces you have inserted around "=" might be part of
>> the issue.
>
>> Here's how I run it from command line.
>
>> Minke:~ ben$ idl -vm=cmd_args.sav -args hello world
>> IDL Version 7.1, Mac OS X (darwin x86_64 m64). (c) 2009, ITT Visual
>> Information Solutions
>
>> arg[0] = hello
>> arg[1] = world
>
>> Here's my test routine
>
>> PRO cmd_args
>
>>     par = COMMAND_LINE_ARGS(COUNT=numArgs)
>>     IF (numArgs NE 0) THEN BEGIN
>>        for i = 0, numArgs-1 do $
>>           print, "arg[" + StrTrim(i,2) + "] = " + par[i]
>>     ENDIF ELSE BEGIN
>>        print, "No arguments passed"
>>     ENDELSE
>
>> END
>
>> I made the SAV file this way...
>
>> IDL> .full_reset
>> IDL> .comp cmd_args
>> % Compiled module: CMD_ARGS.
>> IDL> SAVE, /ROUTINES, filename = "cmd_args.sav"
>
>> Cheers,
>> Ben
>
> It works! thanks Ben

what do I need to modify to run the .sav file from the window
environment.
I know that window doesn't run idl but idlde so any help is
appreciated.

Thanks
Re: run .sav file with -args [message #73646 is a reply to message #73511] Mon, 15 November 2010 12:31 Go to previous message
Truong Le is currently offline  Truong Le
Messages: 42
Registered: September 2010
Member
On Nov 15, 12:27 pm, Ben Tupper <ben.bigh...@gmail.com> wrote:
> On 11/15/10 11:53 AM, Truong Le wrote:
>
>
>
>> On Nov 14, 8:42 pm, Truong Le<truong...@gmail.com>  wrote:
>>> On Nov 14, 8:28 pm, David Fanning<n...@dfanning.com>  wrote:
>
>>>> Truong Le writes:
>>>> > It complains that the sayhello.sav  function/procedure is undefined
>>>> > but the sayhello.sav file does exist. Please let me know if the way I
>>>> > execute my
>>>> > procedure using the .sav file is correct.
>
>>>> Have you tried specifying the complete path to the file?
>
>>>> 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.")
>
>>> when I type
>
>>> idl sayhello.sav -args param1 param2
>
>>> there is a directory widget the pop-up which allows me to select the
>>> sayhello.sav,
>>> so I am sure the path is correct.
>
>> I read other posting and realize that I can't run the .sav file with -
>> args.
>> Here is an example what I try to accomplish.
>
>> I have a procedure that takes command line arguments as follow:
>
>> pro test
>
>>     ; parse the parameters
>>     numArgs = 2
>>     par = COMMAND_LINE_ARGS(COUNT=numArgs)
>
>>     print, par[0]
>>     print, par[1]
>> end
>
>> when I ran this procedure from the dos command line using idlde by
>> doing
>> idlde -args hello hi
>
>> and execute the test procedure it print both "hello" and "hi"
>
>> I ran the idlde build project and this creates a test.sav file
>
>> I need to know how I can execute idl -vm = test.sav from the unix and
>> passing
>> in the two arguments that I need. Is this task not possible?
>
>> Thanks
>
> Hi,
>
> I suspect that the spaces you have inserted around "=" might be part of
> the issue.
>
> Here's how I run it from command line.
>
> Minke:~ ben$ idl -vm=cmd_args.sav -args hello world
> IDL Version 7.1, Mac OS X (darwin x86_64 m64). (c) 2009, ITT Visual
> Information Solutions
>
> arg[0] = hello
> arg[1] = world
>
> Here's my test routine
>
> PRO cmd_args
>
>     par = COMMAND_LINE_ARGS(COUNT=numArgs)
>     IF (numArgs NE 0) THEN BEGIN
>        for i = 0, numArgs-1 do $
>           print, "arg[" + StrTrim(i,2) + "] = " + par[i]
>     ENDIF ELSE BEGIN
>        print, "No arguments passed"
>     ENDELSE
>
> END
>
> I made the SAV file this way...
>
> IDL> .full_reset
> IDL> .comp cmd_args
> % Compiled module: CMD_ARGS.
> IDL> SAVE, /ROUTINES, filename = "cmd_args.sav"
>
> Cheers,
> Ben

It works! thanks Ben
Re: run .sav file with -args [message #73648 is a reply to message #73511] Mon, 15 November 2010 09:36 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Nov 15, 3:27 pm, Ben Tupper <ben.bigh...@gmail.com> wrote:
> Hi,
>
> I suspect that the spaces you have inserted around "=" might be part of
> the issue.
>
> Here's how I run it from command line.
>
> Minke:~ ben$ idl -vm=cmd_args.sav -args hello world

That is just what I was writing. I have used command line arguments
with save files in just that way, with no problems. The pick file
dialog is what IDL shows if one calls it with the -vm argument without
specifying the savefile to use.
Re: run .sav file with -args [message #73649 is a reply to message #73511] Mon, 15 November 2010 09:27 Go to previous message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
On 11/15/10 11:53 AM, Truong Le wrote:
> On Nov 14, 8:42 pm, Truong Le<truong...@gmail.com> wrote:
>> On Nov 14, 8:28 pm, David Fanning<n...@dfanning.com> wrote:
>>
>>
>>
>>> Truong Le writes:
>>>> It complains that the sayhello.sav function/procedure is undefined
>>>> but the sayhello.sav file does exist. Please let me know if the way I
>>>> execute my
>>>> procedure using the .sav file is correct.
>>
>>> Have you tried specifying the complete path to the file?
>>
>>> 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.")
>>
>> when I type
>>
>> idl sayhello.sav -args param1 param2
>>
>> there is a directory widget the pop-up which allows me to select the
>> sayhello.sav,
>> so I am sure the path is correct.
>
> I read other posting and realize that I can't run the .sav file with -
> args.
> Here is an example what I try to accomplish.
>
> I have a procedure that takes command line arguments as follow:
>
> pro test
>
> ; parse the parameters
> numArgs = 2
> par = COMMAND_LINE_ARGS(COUNT=numArgs)
>
> print, par[0]
> print, par[1]
> end
>
> when I ran this procedure from the dos command line using idlde by
> doing
> idlde -args hello hi
>
> and execute the test procedure it print both "hello" and "hi"
>
> I ran the idlde build project and this creates a test.sav file
>
> I need to know how I can execute idl -vm = test.sav from the unix and
> passing
> in the two arguments that I need. Is this task not possible?
>
> Thanks

Hi,

I suspect that the spaces you have inserted around "=" might be part of
the issue.


Here's how I run it from command line.

Minke:~ ben$ idl -vm=cmd_args.sav -args hello world
IDL Version 7.1, Mac OS X (darwin x86_64 m64). (c) 2009, ITT Visual
Information Solutions

arg[0] = hello
arg[1] = world


Here's my test routine

PRO cmd_args

par = COMMAND_LINE_ARGS(COUNT=numArgs)
IF (numArgs NE 0) THEN BEGIN
for i = 0, numArgs-1 do $
print, "arg[" + StrTrim(i,2) + "] = " + par[i]
ENDIF ELSE BEGIN
print, "No arguments passed"
ENDELSE

END


I made the SAV file this way...

IDL> .full_reset
IDL> .comp cmd_args
% Compiled module: CMD_ARGS.
IDL> SAVE, /ROUTINES, filename = "cmd_args.sav"





Cheers,
Ben
Re: run .sav file with -args [message #73650 is a reply to message #73511] Mon, 15 November 2010 08:53 Go to previous message
Truong Le is currently offline  Truong Le
Messages: 42
Registered: September 2010
Member
On Nov 14, 8:42 pm, Truong Le <truong...@gmail.com> wrote:
> On Nov 14, 8:28 pm, David Fanning <n...@dfanning.com> wrote:
>
>
>
>> Truong Le writes:
>>> It complains that the sayhello.sav  function/procedure is undefined
>>> but the sayhello.sav file does exist. Please let me know if the way I
>>> execute my
>>> procedure using the .sav file is correct.
>
>> Have you tried specifying the complete path to the file?
>
>> 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.")
>
> when I type
>
> idl sayhello.sav -args param1 param2
>
> there is a directory widget the pop-up which allows me to select the
> sayhello.sav,
> so I am sure the path is correct.

I read other posting and realize that I can't run the .sav file with -
args.
Here is an example what I try to accomplish.

I have a procedure that takes command line arguments as follow:

pro test

; parse the parameters
numArgs = 2
par = COMMAND_LINE_ARGS(COUNT=numArgs)

print, par[0]
print, par[1]
end

when I ran this procedure from the dos command line using idlde by
doing
idlde -args hello hi

and execute the test procedure it print both "hello" and "hi"

I ran the idlde build project and this creates a test.sav file

I need to know how I can execute idl -vm = test.sav from the unix and
passing
in the two arguments that I need. Is this task not possible?

Thanks
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: LIST performance
Next Topic: Problems with ERODE and DILATE functions

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

Current Time: Wed Oct 08 09:18:17 PDT 2025

Total time taken to generate the page: 0.00743 seconds