[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: Parsing of GetPath



** Reply to message from Patricia M Godfrey  on Fri, 24 Sep
2004 18:49:09 -0400

Patricia:

> when I run [my routine] ... I get "function requires
> ID and expression"...
> What am I doing wrong?

RUNCODE this (Import this Email into XyWrite, DECODE,
then DeFine the block of programming below, and command
RUNCODE

XPLeNCODE v2.0
b-gin [UNTITLED]
=====DeFine=Below=This=Line=====[cr|lf]{<}SX50,{<}VA$FP{>}{>}
{<}SX06,{<}IS50{>}{>}{<}SV51,\{>}[JM_]2.XSR[Q2_]{<}SU07,{<}LB
A{>}[BX_]jmp {<}PV08{>}[Q2_]{<}IF{<}VA$CY{>}>1{>}[MU_]{<}GLA{
>}{<}EI{>}[BS_][MU_][MU_]{>};*;[cr|lf][BX_]ne[Q2_][BX_]wait[Q
2_][WG_]{<}SX01,"Patricia: Step through this program by hitti
ng a key after each screen is displayed.[cr|lf][cr|lf]Observe th
at  contains the complete d:\path\filename.ext of the{032}
file in the adjacent screen: """+{<}IS50{>}+"""[cr|lf][cr|lf]
Note too that frame GetPath, which you run next, uses S/G 50{032}
as both input and output. So S/G 50 is going to be transform
ed![cr|lf] Before GetPath, S/G 50 is """+{<}IS06{>}+"""[cr|l
f] After GetPath, S/G 50 will become """+{<}IS52{>}+"""[cr|l
f]Therefore, we will save the original value of S/G 50 in ano
ther Save/Get (S/G 06) before we transform it via GetPath, fo
r purposes of comparison (and to restore the original content
 of S/G 50 -- to undo the error, so to speak) later.[cr|lf][c
r|lf]BTW, you'd be in trouble if TEMP.TXT already existed --{032}
you'd get an error on the command NE TEMP.TXT. Why not just{032}
command NE, to get an [UNTITLED] window?[cr|lf][cr|lf]Hit a k
ey now..."{>}{<}GT01{>}[TF_][BS_]{<}SX99,{<}RC{>}{>}{<}SX08,{
<}CP{>}{>};*;[cr|lf];*;[cr|lf][JM_]2.GetPath[Q2_][cr|lf][cr|l
f]{<}SX01,"After evaluating S/G 50 in GetPath, the new S/G 50
 = """+{<}IS50{>}+""" (versus old S/G 50 = """+{<}IS06{>}+"""
). *Note* that there is no longer any period ""."" in the ne
w S/G 50! In consequence, when subsequently you try to parse
 S/G 50 for the ""."" character thus:[cr|lf] [cr|lf]there is an error. That's not going to wor
k! If your goal is to get the S/G 50 path+filename into , and the S/G 50 extension into , then GetPath is ser
ving no real purpose here, because GetPath (as it's name sugg
ests) derives the PATH (only!) and *discards* the filename.ex
t.[cr|lf][cr|lf]Hit a key...{>}{<}GT01{>}
{<}GT07{>}{<}SX99,{<}RC{>}{>}{<}SX08,{<}CP{>}{>};*;[cr|lf];*;
[cr|lf];*;[cr|lf]{<}SX50,{<}IS06{>}{>}{<}SV02,.{>}{<}XS50,02,
03,04,05{>};*;[cr|lf];*;[cr|lf][cr|lf][cr|lf]{<}SX01,"Let's r
estore the original value of S/G 50 with "">"". {032}
The following procedure yields your intended results:[cr|lf]{032}
 [cr|lf]After running the (correcte
d) XS procedure above, 'Newfile' is """+{<}IS03{>}+".ps""[cr|
lf]which is derived by concatenation from """+{<}IS03{>}+"."+
{<}IS05{>}+"""[cr|lf][cr|lf]Another way to express this is to
 use the VA@ operator, which enables an alternative form of p
arse, replacing the XS procedure:[cr|lf] >>[cr|lf]The format of VA@ is ""VA@""+S/G number t
o parse+separator character+number of separator element (sub$
tring) within the S/G content. We are assuming here that in{032}
the entire Path+Filename () there is only one period "
"."", i.e. between the filename and the EXTension. That's a{032}
risky assumption because sometimes subdirectory names have pe
riods in them. However... we'll ignore that for the nonce. {032}
If there is only one period, then within  ("""+{<}IS50
{>}+"""), }.{<}MDBO{>}1{<}MDNM{>}> represents{032}
the {<}MDBO{>}first{<}MDNM{>} element or sub$tring ("""+{<}IS
03{>}+""") separated by a {<}MDUL{>}period{<}MDNM{>}, while <
VA@50{<}MDUL{>}.{<}MDBO{>}2{<}MDNM{>}> is the {<}MDBO{>}secon
d{<}MDNM{>} element or sub$tring ("""+{<}IS05{>}+""") separat
ed by a {<}MDUL{>}period{<}MDNM{>}.[cr|lf][cr|lf]Hit a key...
{>}{<}GT01{>}{<}GT07{>}{<}SX99,{<}RC{>}{>}{<}SX08,{<}CP{>}{>}
;*;[cr|lf]{<}SX03,{<}VA@50.1{>}{>}{<}SX05,{<}VA@50.2{>}{>};*;
[cr|lf][cr|lf][cr|lf]Your 'Newfile' is "{<}PV03{>}.ps"[cr|lf]
which is orignally derived from "{<}PV03{>}.{<}PV05{>}"[cr|lf
][cr|lf]QED. [End of mini-program. ABort screen when Done.]
[cr|lf]{<}EX{>}[cr|lf]

-nd
XPLeNCODE

-----------------------------
Robert Holmgren
holmgren@xxxxxxxx
-----------------------------