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

Re: U2 USAVE problem



Reply to note from Harry Binswanger  Thu, 24 Mar 2005
02:08:03 -0500

Harry:

> I was delighted to find the U2 routine USAVE that let's me make
> date-time-stamped backups of open files.

I did some further work on USAVE, but since no one expressed any
interest at the time, I never posted the revision. It's at the foot
of this message; would you plug it in, please? Note that now you can
enable|disable any existing USAVE key assignment on the fly, by
commanding USAVE ON|OFF. The default state is OFF, so you
_must_ issue USAVE ON at least once before the frame will do
any SAving. (To enable via XPL, do JM 2.usaveQ2 .)

> I tried using HIDE/UNHIDE to cover the variables I saw, but
> apparently I'm missing something.

You're missing a colon between HIDE and the S/G numbers! USAVE uses
S/Gs 01-06 and 51, so if your parent routine uses any of these, you'll
need to HIDE them (or RENUMBER your parent routine) before calling
USAVE; to minimize overhead, HIDE _only_ the S/Gs actually used by
your parent routine. E.g., if your routine uses 01-05, do:

JM 2.HIDE:01-05Q2 ;*;

> I'd like to do something like:
>
> DEL C:\0524*.*
>
> but wildcards aren't allowed.

You mean 050324*.*. The filename is in the form YYMMDDxx.xxx.

> I suppose I could do this via calling a .BAT file with the DOS
> command

Why a BATch file? DOS/NV/X/Z /C DEL C:\050324*.* will do.

> (I'd actually like to be able to delete any USAVE files
> produced two days or more before the current date, but that's
> not essential.)

Easy. Command DSORT D to sort DIR listings in ascending date order.
Then issue something like SDIR 0503 or SDIR 05 to
get a list of USAVEd files and ERNV the ones you want to get rid of.

If you want XPL code to automate this, the following will work. Note
that the ERNV command below is disabled with a leading space; to make
this demo code into working code, delete the space:

XPLeNCODE v2.0
b-gin [UNTITLED]
{<}SX21,{<}VA$WA{>}{>}{<}IF{<}PV21{>}<1{>}{<}PRNo window{>}{<
}EX{>}{<}EI{>}[BX_]func #{<}PV21{>}[Q2_]{<}SX21,{<}VA$SD{>}{>
}{<}IF({<}IS21{>}+"{014}"){240}",{014}"{>}{<}SX21,{<}IS21{>}+
",H"{>}{<}EI{>}[BX_]dsort d[Q2_]{<}SX50,{<}VA$DAyy{>}{>}[JM_]
2.sdir[Q2_][BX_]dsort {<}PV21{>}[Q2_];*;[cr|lf];*;[cr|lf][BC_
] ernv[GT_];*; <== delete space before "ernv" to activate com
mand[cr|lf];*;[cr|lf][DO_][FF_][JM_]2.jdn/nv[Q2_]{<}SX21,{<}P
V50{>}-1{>}{<}SV22,{027}X{027}X{>};*;[cr|lf]{<}LBa{>}{<}SX50,
{<}VA$DR{>}{>}{<}IF"___.__"{238}{<}IS50{>}<0{>}[JM_]2.GetPath
[Q2_]{<}XS51,22,,23,24{>}{<}XS24,22,,25,26{>}{<}XS26,22,,27,2
8{>}{<}SX50,{<}IS25{>}+"/"+{<}IS27{>}+"/"+{<}IS23{>}{>}[JM_]2
{046}jdn/nv[Q2_]{<}IF{<}PV50{>}<{<}PV21{>}{>}[XC_][LD_]{<}GLa{>}{
<}EI{>}{<}EI{>}{<}PRDone{>}{<}EX{>}[cr|lf][cr|lf]
-nd
XPLeNCODE

Here's the current version of USAVE:

XPLeNCODE v2.0
b-gin [UNTITLED]
{{;5usave}} Unlimited SAve|Backup|Undo: Save current file wit
h filename YYMMDDHH.MMx [CLD rev. 1/18/05][cr|lf]{002};*;[cr|
lf];*; Assign to non-alpha typing key, e.g., comma (key #51),
 in KBD file;[cr|lf];*;  disable existing key assignment, th
us:[cr|lf];*; ;;51=,[cr|lf];*; 51=COJM(,2,.,u,s,a,v,e,)[cr|lf
];*; STore and reLOAD KBD file[cr|lf];*;[cr|lf];*; USAVE ON|O
FF enables|disables frame USAVE[cr|lf];*; By default
, USAVE is OFF - issue USAVE ON to enable it![cr|lf]
;*;[cr|lf];*; Backups (YYMMDDHH.MMx) are saved in directory s
pecified in[cr|lf];*; XYWWWEB.REG variable Autofile_Saved_Fil
es (default=Editor's directory)[cr|lf];*;[cr|lf]{<}SX01,@upr(
{<}VA@50{>}){>}{<}SX50,{<}VA$ED{>}{>}[JM_]2.GetPath[Q2_]{<}SX
50,{<}IS50{>}+"\USAVE.ON!"{>}{<}IF("|"+@upr({<}VA@01{>})+"|")
{238}"|ON|OFF|"<0{>}[BX_]exist {<}PV50{>}[Q2_]{<}IF@not({<}ER
{>})&{<}VA$WS{>}==1{>}[JM_]2.autofile[Q2_];*;[cr|lf]{<}SV01,{
>}{<}IF{<}VA$MG{>}>""{>}{<}SX01,{<}VA$MG{>}{>}{<}EI{>}{<}PR@0
1{>}{<}EI{>}{<}EX{>}{<}EI{>}{<}IF@upr({<}IS01{>})=="ON"{>}{<}
SV01,Frame USAVE enabled{>}[BX_]sa %01,{<}PV50{>}[Q2_][BX_]wa
it[Q2_][BX_]attrib {<}PV50{>},1[Q2_][BX_]wait[Q2_]{<}PR@01{>}
{<}EX{>}{<}EI{>}{<}IF@upr({<}IS01{>})=="OFF"{>}[BX_]exist {<}
PV50{>}[Q2_]{<}IF@not({<}ER{>}){>}[BX_]attrib {<}PV50{>},0[Q2
_][BX_]wait[Q2_][BX_]ernv {<}PV50{>}[Q2_][BX_]wait[Q2_]{<}PRF
rame USAVE disabled{>}{<}EX{>}{<}EI{>}{<}EI{>}{002}[cr|lf][cr
|lf]
-nd
XPLeNCODE

--
Carl Distefano
cld@xxxxxxxx