At 12:49 AM 9/2/2005, A. Razzak Memon wrote:
Here's one way to achieve your goal to retrieve the name of selected
document as well as the name of directory, as in your example above.
Use the LoadFileName.RBL Plugin along with (CVAL('CURRDIR')) function.
Example:
-- Start
CLEAR VAR vFileName, vDirName
SET VAR vFileName TEXT = NULL
SET VAR vDirName TEXT = NULL
CLS
PLUGINS LoadFileName.RBL 'vFileName +
|FULLPATH OFF +
|TITLE Select Document +
|VIEW_MODE LIST +
|FILTER MS Word Document Files (*.doc)#*.DOC'
SET VAR vDirName TEXT = (CVAL('CURRDIR'))
RETURN
-- End
Both variables (vFileName and vDirName) will return the document
name and directory name accordingly.
At 07:59 AM 9/2/2005, Larry Lustig wrote:
I believe this approach will not work correctly if the user changes
the directory in the dialog before selecting a file.
Try something along these lines (after obtaining the file name):
-- Remove path from filename
SET VAR vFileName = (SRPL(.vFileName, (CVAL('CURRDIR')), '', 0))
-- Remove remaining path delimiter from filename
IF vFileName LIKE '\%' THEN
SET VAR vFileName = (SGET(.vFileName, (SLEN(.vFileName)), 2))
ENDIF
-- Get current directory including trailing path delimiter.
-- (or leave out the delimiter if you don't want it).
SET VAR vCurDir = (CVAL('CURRDIR')) + '\'
At 08:47 AM 9/2/2005, Jim Bentley wrote:
Better still try the following:
SET VAR vxxx = (SRPL(.vFileName, '/', ',', 0))
set var vfile = (ssub(.vxxx,(itemcnt(.vFileName))))
set var vpath = (sget(.vFileName,((SLEN(.vFileName)) - (SLEN(.vfile))),1))
It would be nice if an *enhanced* LoadFileNamePlusPlus.RBL Plugins
returned three parameters:
Example:
SET VAR vPathAndFileName TEXT = NULL
SET VAR vPath TEXT = NULL
SET VAR vFileName TEXT = NULL
PLUGINS LoadFileNamePlusPlus.RBL 'vPathAndFileName vPath vFileName +
|FULLPATH ON +
|TITLE Select Document +
|VIEW_MODE LIST +
|FILTER MS Word Document Files (*.doc)#*.DOC'
SET VAR vDirName TEXT = (CVAL('CURRDIR'))
RETURN
. vPathAndFileName will return the complete string with
. vPath will return the exact path
. vFileName will return the file name
Now you can have your cake and eat it too (Your Way!)
Imagine the possibilities!
Very Best R:egards,
Razzak.