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

Two U2 frames 1. CheckU2dupes 2. Extract



Stimulated by Carl's HLIST frame, which lists all the U2 frames, I wrote
CheckU2dupes to check for frames with the same name.
That required a slight modification of HLIST, to ensure that its SORT
doesn't itself eliminate dupes in its output, and I made 2 other
(documented) slight changes, calling the revised frame HHLIST.
CheckU2dupes runs HHLIST and then DeFines and stores to s/g 50 the text
surrounded between "{{5" and "}}". To do this, it calls another frame that
I wrote recently, that's of wider use: EXTRACT.
EXTRACT will select text between any specified starting and ending
string--which is very helpful in dealing with HTML tags. E.g., you might
want to "scrape" the URL that lies between href=" and the next closing
quote mark. Or you want to get the text lying between  and . The
syntax for it uses an ASCII 252 as a separator:
extract{252}{252}
EXTRACT selects (DeFines) only, it doesn't save to s/g 50. You have to do that separately.
I'm not good at writing system-independent code, so you may have
difficulties, but it looks good on that score to me.

BTW, Carl, I found about a half-dozen dupes in the new U2.

XPLeNCODE v2.0 (ENCODE.EXE)
b-gin [UNTITLED]
{123}{123}5hhlist*{125}{125} Get a sorted list of framenames f
rom any Help file; optionally, list only frames containing a c
ase-INsensitive string {091}CLD rev.8/5/16{093} HB modified to
 set sortkey (sk) default temporarily to 1, 100, so it won't e
lminate dupes; also closes RESULTS.TXT if it's open, and took{032}
out [DX_][cr|lf]{002}[BX_]es 1[Q2_][BX_]gofile RESULTS.TXT[Q2_]
{<}IF@NOT({<}ER{>}){>}[BX_]ab[Q2_]{<}EI{>}{<}SX12,{<}VA$SK{>}{>}
{<}SX01,@upr({<}VA$FR{>}){>}{<}SV02,{>}{<}SV03,{>};*;{<}SV02,f
ile{>}{<}SV03,string{>}[cr|lf]{<}PRWorking{>}{<}IF{<}VA|50{>}>
0{>}{<}SX03,{<}IS50{>}{>}{<}EI{>}{<}SX50,{<}VA$ED{>}{>}[JM_]2.
GetPath[Q2_];*;[cr|lf]{<}SX04,{<}IS50{>}{>}[BX_]ernv {<}PV04{>}
\RESULTS.TXT[Q2_][BX_]wait[Q2_];*;[cr|lf]{<}IF({<}IS03{>}{240}
":\"!"|DG|HL|MN|U1|U2|U3|U4|U5|U6|U7|U8|U9|"{240}("|"{043}@upr
({<}IS03{>}){043}"|"))&";{014}"{238}({<}IS03{>}{043}"{014}")<0
{>}{<}SX03,{<}IS03{>}{043}";"{>}{<}EI{>}{<}IF{<}IS03{>}{240}";
"{>}{<}SV02,;{>}{<}SV50,{>}{<}XS03,02,02,,50{>}{<}SX03,{<}IS50
{>}{>}{<}EI{>}{<}IF{<}VA|02{>}<1{>}{<}SV02,U2{>}{<}EI{>}{<}IF"
|DG|HL|MN|U1|U2|U3|U4|U5|U6|U7|U8|U9|"{240}("|"{043}@upr({<}IS
02{>}){043}"|"){>}{<}SX50,{<}IS02{>}{>}{<}SX02,"{<}VA$"{043}{<}
IS02{>}{043}"{>}"{>}{<}SX02,{<}PV02{>}{>}{<}EI{>}{<}IF{<}IS02{>}
=="(none)"{>}{<}SX05,"No loaded "{043}@upr({<}IS50{>}){043}" f
ile"{>}{<}LBa{>}[DO_]{<}PR@05{>}{<}EX{>}{<}EI{>}{<}IF{<}IS03{>}
{240}"|"!{<}IS03{>}{240}"("!{<}IS03{>}{240}"{091}"!{<}IS03{>}{240}
"{123}"{>}{<}SX01,{<}IS01{>}{043}"R"{>}{<}EI{>}{<}IF"R"{238}{<}
IS01{>}<0{>}{<}SV06,\.^$|{091}({123}*{043}?#{>}{<}SV07,{027}X{>}
{<}LBb{>}{<}SV01,{>}{<}IF{<}VA|06{>}>0{>}{<}SV08,{>}{<}XS06,07
,09,09,08{>}{<}SX06,{<}IS08{>}{>}{<}LBc{>}{<}IF{<}IS03{>}{240}
{<}IS09{>}{>}{<}SV10,{>}{<}XS03,09,11,,10{>}{<}SX01,{<}IS01{>}
{043}{<}IS11{>}{043}"\"{043}{<}IS09{>}{>}{<}SX03,{<}IS10{>}{>}
{<}GLc{>}{<}EI{>}{<}SX03,{<}IS01{>}{043}{<}IS03{>}{>}{<}GLb{>}
{<}EI{>}{<}EI{>}{<}IF{<}IS01{>}{240}"R"{>}{<}SX03,"("{043}{<}I
S03{>}{043}")"{>}{<}EI{>};*;[cr|lf]{<}SX50,"(?im)^\{123}\{123}
{046}*"{043}{<}IS03{>}{043}".*\{125}\{125}.*$"{>}[BX_]sa %50,{<}
PV04{>}\SEARCH.TXT[Q2_];*;[cr|lf][BX_]wait[Q2_]{<}SX50,{<}IS04
{>}{043}"\AI3.EXE "{043}{<}IS04{>}{043}"\REGEX.A3X "{043}{<}IS
02{>}{>}[JM_]2.start/hid[Q2_]{<}SX50,"15,"{043}{<}IS04{>}{043}
"\RESULTS.TXT"{>}[JM_]2.AwaitFile[Q2_][BX_]gofile {<}PV50{>}[Q2_]
{<}IF@not({<}ER{>}){>}[BX_]ab/nv[Q2_]{<}EI{>}[BX_]ca/100 {<}PV
50{>}[Q2_];*;[cr|lf]{<}IF{<}VA$FP{>}=={<}IS50{>}{>}[TF_]{<}LB{032}
2 CHange commands needed ====>{>}[BX_]ch "[wC][w9][wN]>{123}"[wC]
{123}"[Q2_][BX_]wait[Q2_][BX_]ch "[wC][w9][wN]>{123}"[wC]{123}
"[Q2_][BX_]wait[Q2_][TF_][LD_][LD_][YD_][DF_][BF_][DF_];*;[cr|lf]
[BX_]d sk=1,100[Q2_][BX_]sort/nv[Q2_][BX_]wait[Q2_][YD_][TF_][LD_]
[LD_][BX_]ch "[wC]"[wC][wC]"[Q2_][TF_]{<}SV05,{>}{<}IF{<}VA|03
{>}>0{>};*;[cr|lf]{<}SX05,"Search: "{043}{<}IS03{>}{043}" | "{>}
{<}EI{>}{<}SX05,{<}IS05{>}{043}"Help file: "{043}{<}IS02{>}{043}
"[cr|lf]"{>}{<}GT05{>}[TF_][LD_][LD_][BX_]d sk=5,100[Q2_]{<}SV
05,Done{>}{<}GLa{>}{<}EI{>}{<}IF{<}VA$WS{>}==1{>}{<}GT05{>}{<}
EI{>}{<}SV05,Unexpected error{>}{<}GLa{>}{002} [cr|lf][cr|lf]{123}
{123}5CheckU2dupes,ckd{125}{125} Exits if it finds one. Calls{032}
frame EXTRACT (immediately below)[cr|lf]{002}{<}SV50,{>}{<}SV5
1,{>};*;[cr|lf][JM_]2.hhlist[Q2_][TF_];*;[cr|lf]{<}SV97,{123}{>}
{<}SV98,{125}{>};*; using 97 and 88 to {126}interfere with fra
me extract or hhlist[cr|lf]{<}LBA{>};*; LOOP [cr|lf][JM_]2.ex
tract{252}{<}PV97{>}{<}PV97{>}{252}{<}PV98{>}{<}PV98{>}[Q2_];*
;[cr|lf]{<}IF{<}VA$DE{>}<>1{>}{<}PR error in CheckU2Dupes{>}{<}
EX1{>}{<}EI{>};*;[cr|lf]{<}SV50{>};*;[cr|lf]{<}IF{<}IS50{>}<>{<}
IS51{>}{>};*; present selection doesn't duplicate previous[cr|lf]
{<}SX51,{<}IS50{>}{>};*; update previous selection to present{032}
one, for next loop[cr|lf]{<}GLA{>};*; see if next pair is a du
pe[cr|lf]{<}EI{>};*;[cr|lf];*;Below here, have found a dupe, s
o show it in the U2[cr|lf]{<}SX51,{<}VA$U2{>}{>};*;[cr|lf][BX_]
gofile {<}PV51{>}[Q2_]{<}IF{<}ER{>}{>}[BX_]ca/100 {<}PV51{>}[Q2_]
{<}EI{>};*; open U2 [cr|lf][XP_][XD_][TF_][BX_]se/f {179}{<}PV
50{>}{179}[Q2_][XD_][DF_][BX_]se {179}{<}PV50{>}{179}[Q2_]{<}P
R dupe found{>}{<}EX1{>}{002}[cr|lf][cr|lf]{123}{123}5extract*
{125}{125} DeFines the text that lies between specified start{032}
and end. E.g., extract{252}{252} will select{032}
"Harry Binswanger" if it lies between "" and "}{>}{<}SX02,{<}VA@01{252}2{>}{>}{<}SX03,{<}VA@01{252}
3{>}{>};*; parse out the args[cr|lf][BX_]se {179}{<}PV02{>}{179}
[Q2_];*;[cr|lf]{<}IF{<}ER{>}{>};*;[cr|lf]{<}IF{<}IS97{>}=="{123}
"&{<}IS98{>}=="{125}"{>}[XD_][TF_]{<}PRNo duplicate frames fou
nd{>}{<}EX1{>}{<}EI{>};*;[cr|lf]{<}PRU2 extract frame reports:
 not found: @02{>}{<}EX1{>}[cr|lf]{<}EI{>};*;[cr|lf][XD_][DF_]
;*;[cr|lf][BX_]se/f {179}{<}PV03{>}{179}[Q2_];*;[cr|lf]{<}IF{<}
ER{>}{>};*;[cr|lf]{<}PRU2 extract frame reports: not found: @0
3{>}{<}EX1{>}[cr|lf]{<}EI{>};*;[cr|lf][DF_]{<}EX{>}{002}[cr|lf]
-nd
XPLeNCODE