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

Re: auto-truncation



** Reply to message from "Myron Gochnauer"  on Mon, 25 Nov 2002
09:09:14 -0400

Myron:

> Does anyone have an XPL program that automatically truncates long file names
> on the command line?

Here's a stab at the truncation idea. Save this msg to
disk, open it in XyWrite, command DECODE, plug the
block of three XPL frames into U2 (in the middle anywhere),
then command LOADHELP. It works pretty well. I've
included also the Help frame that will accompany it in the
next release of U2, to explain the usage -- *note* the caveats
at the end. The main frame, TRUNC, is just a generic engine
that converts files and paths into 8.3; you can then design
applications around the engine -- LCA and LCD, per your
suggestion, are bundled sample applications.

Note that there's a potentially big problem with fitting
"long" paths\filenames on the CMline. U2 has two programs
which overcome that limitation, called CML (a "long" CMline)
and U2L (the equivalent if you ordinarily execute a command
with the  rather than carriage return or eXeCute
key). CML and U2L both open a small window that can accept
much longer input (660 chars, instead of 78 or 80). For
example, you might put "CALL XYWWWEB.U2" [let's pretend
that's too long to fit on the CMline] in a CML window, then
command "CML" on the CMline, to execute it.

Try it out. Here's the Help frame, followed by the three
XPL frames.


XPLeNCODE v2.0
b-gin [UNTITLED]
----------------[cr|lf]{trunc,lca,lcd} {<}IP0DI,2DI{>}[cr|lf]
[cr|lf]Truncate long path and file names to 8.3 format (S/G50
 In, S/G50 Out)[cr|lf]Trunc is a common resource, called as a
 child process by other commands, e.g. the exemplary parent p
rocesses LCA and LCD.[cr|lf]Trunc accepts as input:[cr|lf] D
eFined text in the current document (overrides other input)[c
r|lf] CMline text[cr|lf] U2L window text[cr|lf] Text passe
d to the routine as S/G 50[cr|lf][cr|lf]{<}MDUL{>}Usage{<}MDN
M{>}:[cr|lf][255+065+069]SV50,[[d:]\path\][file][255+065+070]
[JM_]2.TRUNC[Q2_] <==for example[cr|lf]LCA file_to_truncate <==CAll a long filename[cr|lf]LCD path_to_truncate <==Change to a long Directory[cr|lf][cr|lf]{<}MDUL{>
}Tip{<}MDNM{>}: Open a {<}MDSO{>}{<}LBLink{<}SV50,u2l*{>}[JM
_]2.Help[Q2_]{>}U2L{<}MDNM{>} window to enter long commands t
hat won't fit on CMline[cr|lf][cr|lf]{<}MDUL{>}Examples{<}MDN
M{>}:[cr|lf]Open a U2L window (command U2L); put the
 following LCA command in the U2L window; then, on CMline, ag
ain command U2L to eXeCute it:[cr|lf] LCA C:\Documen
ts and Settings\All Users\Microsoft\No.Such.File\No.Such File
\dvdonet_Netscape.csslim[cr|lf]Executes: ca C:\Docume~1\AllUs
e~1\Micros~1\No~1.Fil\No~1.Suc\dvdone~1.css[cr|lf][cr|lf]Put{032}
following LCD command on CMline (because it fits):[cr|lf] LCD
 C:\Program Files\PC-Doctor for Windows 2000[cr|lf]E
xecutes: cd C:\Progra~1\PC-Doc~1[cr|lf] [cr|lf]{<}MDUL{>}Cav
eats{<}MDNM{>}:[cr|lf]Trunc[ate] is not perfect. It guesses{032}
probable 8.3 formats. It fails in two uncommon situations:[c
r|lf]1) Trunc only uses "~1" -- never "~2", "~3", etc.[cr|lf]
2) Occasionally, strange filenames are assigned by the system
, for reasons unknown. For example, when FO.TMP in a root di
rectory was RENamed to FO.TMPORARY, it acquired the 8.3 name{032}
"FOE51B~1.TMP" -- TRUNC would anticipate "FO~1.TMP".[cr|lf]{<
}FC{>}[cr|lf]For Use by RENUMBER:[cr|lf]Default Save/Get Rang
e=01-16,50-51[cr|lf]Renumber TRUNC in PACK mode, RANGE 01-16[
cr|lf]{<}FL{>}[cr|lf]----------------[cr|lf]{{;5trunc}} Trunc
[ate] pathname|filename to 8.3 format RJH 11/28/2002[cr|lf]{
002}{<}IF{<}VA$DF{>}>0{>}[DZ_]{<}SV50{>}{<}EI{>}{<}SV01,{>}{<
}SX02,{<}IS50{>}{>}{<}SV03,\{>}{<}SV04,.{>}{<}SV05,{027}X{027
}X{027}X{027}X{027}X{027}X{>}{<}SV06,{027}X{027}X{027}X{>}{<}
SV07, {>}{<}SU08,{<}XS09,04,10,,11{>}{<}IF{<}VA|10{>}>8!{<}VA
|11{>}>3!{<}IS10{>}{240}" "!{<}IS11{>}{240}" "{>}{<}LBA{>}{<}
IF{<}IS10{>}{240}" "{>}{<}XS10,07,12,07,13{>}{<}SX10,{<}IS12{
>}+{<}IS13{>}{>}{<}GLA{>}{<}EI{>}{<}IF{<}VA|10{>}>6{>}{<}XS10
,05,,13,14{>}{<}SX10,{<}IS13{>}{>}{<}EI{>}{<}SX10,{<}IS10{>}+
"~1"{>}{<}EI{>}{<}SX01,{<}IS01{>}+{<}IS10{>}+"."{>}{<}LBB{>}{
<}IF{<}IS11{>}{240}"."{>}{<}XS11,04,,04,10{>}{<}SX11,{<}IS10{
>}{>}{<}GLB{>}{<}EI{>}{<}LBC{>}{<}IF{<}IS11{>}{240}" "{>}{<}X
S11,07,12,07,13{>}{<}SX11,{<}IS12{>}+{<}IS13{>}{>}{<}GLC{>}{<
}EI{>}{<}IF{<}VA|11{>}>3{>}{<}XS11,06,,13,14{>}{<}SX11,{<}IS1
3{>}{>}{<}EI{>}{>}{<}SU15,{<}SX16,8{>}{<}LBD{>}{<}IF{<}IS09{>
}{240}" "{>}{<}XS09,07,12,07,13{>}{<}SX09,{<}IS12{>}+{<}IS13{
>}{>}{<}SX16,6{>}{<}GLD{>}{<}EI{>}{<}IF{<}VA|09{>}>{<}PV16{>}
{>}{<}XS09,05,,13,14{>}{<}SX16,6{>}{<}EI{>}{<}IF{<}PV16{>}==6
{>}{<}SX09,{<}IS13{>}+"~1"{>}{<}EI{>}{>};*; Main:[cr|lf]{<}LB
E{>}{<}IF{<}IS50{>}{240}"\"{>}{<}SV09,{>}{<}SV02,{>}{<}XS50,0
3,09,,02{>}{<}SX50,{<}IS02{>}{>}{<}IF{<}VA|09{>}<1!":"{238}{<
}IS09{>}==1{>}{<}SX01,{<}IS01{>}+{<}IS09{>}+"\"{>}{<}GLE{>}{<
}EI{>}{<}IF{<}IS09{>}{240}"."{>}{<}GT08{>}{<}SX01,{<}IS01{>}+
{<}IS11{>}+"\"{>}{<}GLE{>}{<}EI{>}{<}GT15{>}{<}SX01,{<}IS01{>
}+{<}IS09{>}+"\"{>}
{<}GLE{>}{<}EI{>}{<}SX09,{<}IS02{>}{>}{<}IF{<}IS09{>}{240}"."
{>}{<}GT08{>}{<}SX50,{<}IS01{>}+{<}IS11{>}{>}{<}PR@50{>}{<}EX
{>}{<}EI{>}{<}GT15{>}{<}SX50,{<}IS01{>}+{<}IS09{>}{>}{<}PR@50
{>}{002}[cr|lf][cr|lf]{{;5lca}} CA trunc[ated] file using 8.3
 format RJH 11/28/2002[cr|lf]{002}{<}IF{<}VA|50{>}>0{>}[JM_]
2.trunc[Q2_][BX_]ca {<}PV50{>}[Q2_]{<}PRca @50{>}{<}EI{>}{002
}[cr|lf][cr|lf]{{;5lcd}} CD (trunc[ate]) using 8.3 format RJ
H 11/28/2002[cr|lf]{002}{<}IF{<}VA|50{>}>0{>}[JM_]2.trunc[Q2_
]{<}IF":"{238}{<}IS50{>}==1{>}{<}SX51,{<}VA@50:1{>}{>}[BX_]{<
}PV51{>}:[Q2_]{<}EI{>}[BX_]cd {<}PV50{>}[Q2_]{<}PRcd @50{>}{<
}EI{>}{002}[cr|lf]----------------[cr|lf]
-nd
XPLeNCODE


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