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

Home » Public Forums » archive » Re: alias in idl
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: alias in idl [message #44052] Mon, 16 May 2005 15:10 Go to next message
Michael Wallace is currently offline  Michael Wallace
Messages: 409
Registered: December 2003
Senior Member
Koh Leong Tah wrote:
> hi all,
> i have a directory which I happen to restore structures on pretty often
> and i was wondering if there's a way to have a shortcut name to that
> directory that i can setup, maybe in .idlinit?
> thanks,
> kl
>


Besides what has already been mentioned, you can also create an
environmental variable with a value of the directory path. Then, in IDL
you can use:

dir = getenv('NAME_OF_ENV_VAR')

Something like this is can be really handy if you give your code to
someone else and they have a different directory structure. Instead of
editing your code or IDL startup files, you only have to create the
appropriate variable. Just another way to skin this cat.

Of course, I'd say to go with the solutions that have already been
offered. Something like this only needs to be used if you want to
distribute your code to others.

-Mike
Re: alias in idl [message #44053 is a reply to message #44052] Mon, 16 May 2005 14:53 Go to previous messageGo to next message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Koh Leong Tah wrote:

> hi all,
> i have a directory which I happen to restore structures on pretty often
> and i was wondering if there's a way to have a shortcut name to that
> directory that i can setup, maybe in .idlinit?
> thanks,
> kl


Hi,
I like to add thats you could set up a system var in your IDL_STARTUP file.
defsysv,'!sdata','/tmp'

Sysvars are global
IDL> help,!sdata
<Expression> STRING = '/tmp'

IDL> cd, !sdata

cheers

Reimar

--
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
Re: alias in idl [message #44054 is a reply to message #44053] Mon, 16 May 2005 13:04 Go to previous messageGo to next message
Benjamin Hornberger is currently offline  Benjamin Hornberger
Messages: 258
Registered: March 2004
Senior Member
Koh Leong Tah wrote:
> hi all,
> i have a directory which I happen to restore structures on pretty often
> and i was wondering if there's a way to have a shortcut name to that
> directory that i can setup, maybe in .idlinit?
> thanks,
> kl
>

If I understand it right, you want to CD to a certain directory without
typing the full directory name all the time. You could

1. Assign the full path to a string variable in your IDL startup file

mydir = '/very/long/full/path/to/dir'

Then you can just do

IDL> cd, mydir


2. Write a procedure

PRO cdmydir

cd, '/very/long/full/path/to/dir'

END

and the do

IDL> cdmydir

whenever you need it.

Cheers,
Benjamin
Re: alias in idl [message #44144 is a reply to message #44053] Tue, 17 May 2005 09:38 Go to previous message
R.G. Stockwell is currently offline  R.G. Stockwell
Messages: 363
Registered: July 1999
Senior Member
> Koh Leong Tah wrote:
>
> hi all,
> i have a directory which I happen to restore structures on pretty often
> and i was wondering if there's a way to have a shortcut name to that
> directory that i can setup, maybe in .idlinit?
> thanks,
> kl

All the other suggestions are good. I'd just mention that I find it
quite helpful to have a "configuration" object, with methods such
as "get_datadir", "cd_datadir", "get_workingdir", "cd_workingdir",
"get_winddatadir", "get_tempdatadir", etc.
so that the code is always the same, and if you change directory structure
(such as switching between windows and linux) then the only place you
need make changes is in the configuration file.

In fact, I do a "computer name" check, and return the appropriate path.
Of course, in IDL, it is just as easy to make a procedure (and perhaps have
keywords instead of methods.

Cheers,
bob
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: LabView script node and NetCDF
Next Topic: Re: Looking for IDL code documentation standards

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

Current Time: Sun Oct 12 07:07:06 PDT 2025

Total time taken to generate the page: 0.96091 seconds