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

Home » Public Forums » archive » Opening variable files
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
Opening variable files [message #7951] Thu, 30 January 1997 00:00 Go to next message
Christopher E. Crabtr is currently offline  Christopher E. Crabtr
Messages: 1
Registered: January 1997
Junior Member
I am an undergraduate as Washington University. We purchased IDL in the
summer of 96. I am currently trying to write a widget based application
and I ran into a problem. I want the user to be able to open a file of
his or her choosing, but when I try to use the statement

openr, 1, filename

where filename is a string (variable) I get a message saying that a scalar
value is expected. Is there any way to allow the user to enter in the new
file name without exiting the application and recompiling the program with
the new 'filename' inserted.

Thanks,


Chris Crabtree
cecrabtr@artsci.wustl.edu
Re: Opening variable files [message #8016 is a reply to message #7951] Fri, 31 January 1997 00:00 Go to previous messageGo to next message
Jack Harlan is currently offline  Jack Harlan
Messages: 4
Registered: October 1996
Junior Member
I would recommend using PICKFILE, a widget for exactly this purpose.
It's in the IDL Ref Guide.

* Jack Harlan
* NOAA Environmental Technology Laboratory
* 325 Broadway * Boulder, CO 80303
* 303-497-6032 PH * 303-497-3577 FAX
Re: Opening variable files [message #8049 is a reply to message #7951] Thu, 30 January 1997 00:00 Go to previous messageGo to next message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Chris Crabtree" <cecrabtr@artsci.wustl.edu> writes:

> I am currently trying to write a widget based application
> and I ran into a problem. I want the user to be able to open a file of
> his or her choosing, but when I try to use the statement
>
> openr, 1, filename
>
> where filename is a string (variable) I get a message saying that a scalar
> value is expected. Is there any way to allow the user to enter in the new
> file name without exiting the application and recompiling the program with
> the new 'filename' inserted.

Chris, you probably got this filename from a text widget. When you
get the value of a text widget, you always are returned a string
*array*, even if there is only one "thing" in your text widget.

You can make your program work by typing this:

openr, 1, filename(0)

But this is lousy code. :-)

I'd use this:

OPENR, lun, filename(0), /GET_LUN

This will save you some headaches down the road debugging
your programs. Tell your advisor you need a copy of "Building
Graphical User Interfaces in IDL", too. You can get it from RSI.

David

-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
2642 Bradbury Court, Fort Collins, CO 80521
Phone: 970-221-0438 Fax: 970-221-4762
E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com
-----------------------------------------------------------
Re: Opening variable files [message #8075 is a reply to message #7951] Tue, 04 February 1997 00:00 Go to previous message
D.Kennedy is currently offline  D.Kennedy
Messages: 26
Registered: January 1997
Junior Member
In article <Pine.SOL.3.95.970130104307.19425B-100000@ascc.artsci.wustl.edu>,
"Christopher E. Crabtree" <cecrabtr@artsci.wustl.edu> writes:
> I am an undergraduate as Washington University. We purchased IDL in the
> summer of 96. I am currently trying to write a widget based application
> and I ran into a problem. I want the user to be able to open a file of
> his or her choosing, but when I try to use the statement
>
> openr, 1, filename
>
> where filename is a string (variable) I get a message saying that a scalar
> value is expected. Is there any way to allow the user to enter in the new
> file name without exiting the application and recompiling the program with
> the new 'filename' inserted.

I use this:

; Pop up a window and let the user select the datafile
SET_PLOT, 'X'
datafile= PICKFILE(GET_PATH=path, PATH='/home7/dcjk/M15-radio/', $
/READ, FILTER='*.data')

; Tidy up the pathname etc
IF STRMID(path(0), STRLEN(path(0))-1,1) NE '/' THEN path = path(0) + '/'

; Open file
OPENR, input, datafile, /GET_LUN

--
David Kennedy, Dept. of Pure & Applied Physics, Queen's University of Belfast
Email: D.Kennedy@Queens-Belfast.ac.uk | URL: http://star.pst.qub.ac.uk/~dcjk/
Hi! I'm a .signature virus! Copy me into yours and join the fun!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: surface plots with color shading
Next Topic: Angstrom symbol?

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

Current Time: Wed Oct 08 18:52:51 PDT 2025

Total time taken to generate the page: 0.00692 seconds