Re: open files in some directory [message #32953 is a reply to message #32950] |
Mon, 18 November 2002 19:41  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
tom (tom2959@21cn.com) writes:
> Hi, I'd like to open one file in a directory. For example,
> openr,1,'d:\data\1.txt'
> but next time maybe open 2.txt in that directory. I donot want to change the
> code every time. Are there any method when the program excute at openr, a
> window containing the files can jump out and then I can chose files in the
> directory to be opened? Somebody told me Matlab code:
> [fname,fpath]=uigetfile('*.*','Data'), but I donot use Matlab.
How about something like this:
filename = Dialog_Pickfile(Filter='*.txt', Path='D:\Data\')
IF filename EQ "" THEN RETURN
OpenR, lun, filename, /Get_Lun
You shouldn't have to learn MatLab just to read the
name of your data file into your program. :-)
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|