[Date Prev][Date Next][Subject Prev][Subject Next][
Date Index][
Subject Index]
Re: Getting the path of a file
- Subject: Re: Getting the path of a file
- From: cld@xxxxxxxx (Carl Distefano)
- Date: Mon, 20 Jan 2003 14:41:28 -0500
Reply to note from "Martin J. Osborne"
Mon, 20 Jan 2003 13:11:40 -0500
> Suppose I have the file \xxx\yyy\zzz\file.ext open and my
> default directory is something other than \xxx\yyy\zzz. I'd
> like to put the path to the file, namely \xxx\yyy\zzz in a
> variable. Is there an easy way to get that path?
Yes, Martin, there is. Put the fully-qualified filename into
Save/Get 50, then execute U2 frame GETPATH. The path portion of the
filename is output to Save/Get 50. For example, suppose the
filename is G:\DATA\2002\FAX\HERR.F8. You'd code as follows:
JM 2.GetPathQ2 ;*;
where "<" and ">" are real guillemets and "JM " and "Q2 " are 3-byte
functions.
After executing the above code, S/G 50 contains the string
"G:\DATA\2002\FAX" (note that the final backslash is omitted).
The real power of GetPath becomes evident when the input is a
variable, for example, , the path and filename of the
currently-displayed file. To put that path string into S/G 50:
>JM 2.GetPathQ2 ;*; S/G 50 now has the path
Command HELP GETPATH for further information.
Needless to say, after executing GetPath, Save/Get 50 can be further
manipulated. For example, to open a new file, named NEWFILE, in the
S/G 50 directory:
BX ne \newfileQ2 ;*; Note the backslash before the filename
Two other frames should be mentioned here. GFD sets the
path to the d:\path of the currently-displayed file. GXD
sets the path to the d:\path of EDITOR.EXE (or its equivalent in
XyWin and NBWin). I use these two frames so often, I've assigned
them to keys:
nn=NOXHJM(,2,.,g,f,d,)
nn=NOXHJM(,2,.,g,x,d,)
--
Carl Distefano
cld@xxxxxxxx
http://users.datarealm.com/xywwweb/