Re: System Variables & .sav files [message #40201] |
Tue, 27 July 2004 20:35  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
HyperJiver writes:
> Thanks for the input. Let me write what I understand of the program
> I am trying to work with.
>
> I have a seperate program, setup.pro that does not require any input
> from the user & there are no widgets. The program is usually run using
> a macro that runs a batch file
>
> @bathfilename.pro --
>
> ON_ERROR,1
>
> ;run setup - Uses DEFSYS to define system variables
> [DEFSYSV,"!MY_dir",basedir + libdir (basedir & libdir are defined)]
>
> SETUP
>
> ;run xmanager
>
> XMANAGER
>
> ;run main - uses the system variables that have be defined in
> setup.pro
>
> MAIN
>
>
> - When I try to run the macro- it works fine
> - When I run all these in the command prompt, it works fine
> - To do a standalone application, I executed all these commands in the
> command prompt as follows
>
> on_error,1
> .run setup
> setup
> .run xmanager
> .run main
> resolve_all
> save,/routines, filename = "filename.sav"
>
> When I run the .sav file, I get an error - '!MY_dir is not a legal
> system variable'
Oh, dear. :-(
I have to admit there are days when after 16+ years
of working with IDL I think I have seen it all. But
this setup completely and utterly baffles me. I've never
seen the like. :-)
As far as I can see the issue is not why this DOESN'T
run as a stand-alone application, but why it DOES
run in any other configuration!
I really don't know what to tell you. Sorry.
I guess I'd have to see what that MAIN routine
really does.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: System Variables & .sav files [message #40210 is a reply to message #40201] |
Tue, 27 July 2004 10:55   |
hyperjiver
Messages: 10 Registered: July 2004
|
Junior Member |
|
|
Dear David,
Thanks for the input. Let me write what I understand of the program
I am trying to work with.
I have a seperate program, setup.pro that does not require any input
from the user & there are no widgets. The program is usually run using
a macro that runs a batch file
@bathfilename.pro --
ON_ERROR,1
;run setup - Uses DEFSYS to define system variables
[DEFSYSV,"!MY_dir",basedir + libdir (basedir & libdir are defined)]
SETUP
;run xmanager
XMANAGER
;run main - uses the system variables that have be defined in
setup.pro
MAIN
- When I try to run the macro- it works fine
- When I run all these in the command prompt, it works fine
- To do a standalone application, I executed all these commands in the
command prompt as follows
on_error,1
.run setup
setup
.run xmanager
.run main
resolve_all
save,/routines, filename = "filename.sav"
When I run the .sav file, I get an error - '!MY_dir is not a legal
system variable'
Please Help,
Thanks,
-HJ
David Fanning <davidf@dfanning.com> wrote in message news:<MPG.1b6f2177717b420f9897e9@news.frii.com>...
> HyperJiver writes:
>
>> 1) Do system variables have to be declared in a different way if I
>> intend to run a stand alone application?
>
> I don't use system variables normally, but I don't
> think so. I can't think of a reason why it *would*
> be so.
>
>> 2) Is there a different way to save the .sav file[I used
>> save,/routines, filename = "somefile.sav"] to have the system variable
>> definitions to be legal?
>
> No, this is the only way to do it.
>
>> 3) Has anyone here encountered similar problems and have a solution to
>> it?
>
> How, exactly, is the user setting these system variables?
> Is there some kind of user interaction with a widget program?
> Is it possible that program is a blocking widget, rather than
> a modal widget, and it is running through its block and returning
> a value before the user has actually entered something? That seems
> more likely, to me.
>
> Remember, in run-time IDL there is no command line to
> block, so no blocking is ever done unless you specifically
> request it (I.e., by making the widget modal).
>
> Cheers,
>
> David
|
|
|
Re: System Variables & .sav files [message #40220 is a reply to message #40210] |
Mon, 26 July 2004 14:11   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
HyperJiver writes:
> 1) Do system variables have to be declared in a different way if I
> intend to run a stand alone application?
I don't use system variables normally, but I don't
think so. I can't think of a reason why it *would*
be so.
> 2) Is there a different way to save the .sav file[I used
> save,/routines, filename = "somefile.sav"] to have the system variable
> definitions to be legal?
No, this is the only way to do it.
> 3) Has anyone here encountered similar problems and have a solution to
> it?
How, exactly, is the user setting these system variables?
Is there some kind of user interaction with a widget program?
Is it possible that program is a blocking widget, rather than
a modal widget, and it is running through its block and returning
a value before the user has actually entered something? That seems
more likely, to me.
Remember, in run-time IDL there is no command line to
block, so no blocking is ever done unless you specifically
request it (I.e., by making the widget modal).
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: System Variables & .sav files [message #40300 is a reply to message #40201] |
Tue, 27 July 2004 21:13  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
David Fanning writes:
>> - When I try to run the macro- it works fine
>> - When I run all these in the command prompt, it works fine
>> - To do a standalone application, I executed all these commands in the
>> command prompt as follows
>>
>> on_error,1
>> .run setup
>> setup
>> .run xmanager
>> .run main
>> resolve_all
>> save,/routines, filename = "filename.sav"
>>
>> When I run the .sav file, I get an error - '!MY_dir is not a legal
>> system variable'
>
> Oh, dear. :-(
>
> I have to admit there are days when after 16+ years
> of working with IDL I think I have seen it all. But
> this setup completely and utterly baffles me. I've never
> seen the like. :-)
>
> As far as I can see the issue is not why this DOESN'T
> run as a stand-alone application, but why it DOES
> run in any other configuration!
After taking a shower and thinking about it a bit
more, I have a theory. :-)
I think what is happening is that only the MAIN
procedure is getting saved, with NO system variables
set. That's where the error comes from.
Try this. Put the SETUP call in the MAIN routine
on the first line after the procedure definition
statement. Something like this"
PRO Main
SETUP
...
END
Then do this in a new IDL session:
IDL> .compile main
IDL> resolve_all
IDL> Save, /Routines, Filename='main.sav'
Exit IDL, and double click "main.sav". Does *that*
work?
Cheers,
David
P.S. Let's just say seeing that ol' XManager call
out there all by his lonesome just gives me the
shivers!!
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|