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))
--
Jim Bentley
American Celiac Society
email: [EMAIL PROTECTED] 





-----Original Message-----
From:     Lawrence Lustig <[EMAIL PROTECTED]>
Sent:     Fri, 2 Sep 2005 04:59:06 -0700 (PDT)
To:       [email protected] (RBASE-L Mailing List)
Subject:  [RBASE-L] - Re: Parsing a returned value

> 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'))
> 
> Both variables (vFileName and vDirName) will return the document
> name and directory name accordingly.

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')) + '\'

--
Larry

Reply via email to