8-Bit Software Online Conversion
Tree Rename (Revised) - Listing
10REM
20*|"
30*|" Tree Rename v2.01
40*|"
50*|" Filename: TreRen2
60*|"
70*|" Written by Alex Savvides
80*|" For 8-Bit Public Domain
90*|"
100*|" Thanks to Hugh Williams
110*|"
120*|" A program to rename one
130*|" or all files in one
140*|" directory to another
150*|"
160*|" Updated : 2 January 1992
170*|"
180*|" Please see manual files:
190*|" T.reetxt1 & T.reetxt2
200*|" for full instructions
210*|"
220*|"
230*|" THIS PROGRAM MAY BE COPIED
240*|" FREELY AND GIVEN TO ANYONE
250*|" WHO MAY FIND IT USEFUL
260*|"
270:
280IFPAGE<>&1900THENPRINT'" Set PAGE t
o &1900 and re-load":END
290:
300*TV 255
310MODE7
320PROCmaster
330DIMfile$(34),mark$(34),p%256
340:
350PROCinit
360PROCoff
370PROCtitle
380:
390ONERRORIFERR<>17PROCerror
400:
410REPEAT
420VDU28,0,23,39,4,12
430PROCclear`tags
440PROCread`files
450IFB%=0THENPROCno`files:GOTO390
460PROCsort
470PROCnot`available
480PROCget`title
490PRINT" Unlocking files..."
500*ACC.*.*
510PROCwork`screen
520IFH=68THENPROCclear`tags:GOTO390
530UNTILH=81
540VDU26,12:PRINT" ";CHR$157" Thanks f
or using Tree Rename v2.01 !"''
550*B.
560END
570:
580REM
590REM" Read in files
600REM
610DEFPROCread`files
620PROCoff
630PRINT" Reading catalogue ";
640PROCclr`mem
650*DIR$
660*FX3 2
670REM" See note below:
680*.
690*.
700REM" IMPORTANT: This program
710REM" should NOT be run if above
720REM" two lines are not identical
730REM" This is to avoid the dfs
740REM" corrupting the catalogue
750REM" which it will if the disk
760REM" has not been allowed to
770REM" stop spinning before the
780REM" program is run...
790*FX3
800A%=&0E08
810B%=1
820REPEAT
830IF?(A%+7)=0THENR$="$."ELSER$=CHR$(?
(A%+7))+"."
840file$(B%)=R$
850D%=0
860REPEAT
870IF?(A%+D%)>0OR?(A%+D%)<>&FFTHENfile
$(B%)=file$(B%)+CHR$((?(A%+D%))AND127)
880D%=D%+1
890UNTILD%=7OR?(A%+D%)=32
900file$(B%)=FNupcase(file$(B%))
910IFfile$(B%)="$.!BOOT"THENmark$(B%)=
no$
920IFMID$(file$(B%),3,1)<>CHR$0ANDLEN(
file$(B%))>=2THENB%=B%+1
930A%=A%+8
940UNTIL?A%=0ORA%=&F00ORB%=32
950B%=B%-1
960PRINT;B%;" file(s) found"
970ENDPROC
980:
990REM
1000REM" Rename tagged files
1010REM
1020DEFPROCrename`files
1030LOCALF
1040done=0
1050IFS$=D$PROCcode(2):ENDPROC
1060IFFNcount`tagged=FNtaggedTHENPROCme
ssage("File(s) already exist",1):S$="":D
$="":PROCuntag`all(1):hilited=1:ENDPROC
1070IFFNare`you`sure=FALSETHENENDPROC
1080PROCdubcheck
1090VDU26
1100fin=FNtagged
1110PROChelp`menu
1120VDU26
1130PRINTTAB(26,20);fin;" ";CHR$156
1140PRINTTAB(16,20);FNtagged
1150VDU28,0,17,39,7,30
1160F=0
1170FORn=1TOB%
1180ren=0
1190found=FALSE
1200REPEAT:ren=ren+1
1210IFmark$(ren)=tag$THENfound=TRUE
1220UNTILfound=TRUEORren=B%ORfin=F
1230IFfound=TRUETHENF=F+1:GOTO1250
1240IFren=B%ORF=finTHENGOTO1450
1250a$=file$(ren)
1260key=INKEY(0)
1270IFkey=9THENPROCmessage("Rename term
inated",1):n=B%:PROCuntag`all(0):n=B%:GO
TO1450
1280IFa$=""THENGOTO1450
1290hilited=LEN(a$)-2
1300b$=MID$(a$,3,hilited)
1310IFS$<>""ANDD$<>""THENIFLEFT$(a$,1)<
>S$GOTO1450
1320IFS$=""ANDD$<>""ANDLEFT$(a$,1)=D$TH
ENGOTO1190
1330IFFNms(a$)=TRUETHENGOTO1430
1340PROCtreb(a$)
1350OSCLI"RENAME "+a$+" "+D$+"."+b$
1360file$(ren)=D$+MID$(file$(ren),2,LEN
(file$(ren)))
1370PROCsearch
1380PRINTTAB(ex,wi);" ";ren$;D$;
1390mark$(ren)=ren$
1400done=done+1
1410VDU26
1420PRINTTAB(16,20);" "
1430PRINTTAB(16,20);FNtagged
1440VDU28,0,17,39,7,30
1450NEXTn
1460S$="":D$=""
1470menu=2
1480PROCcommands
1490PROCmessage(STR$(done)+" file(s) re
named",1)
1500PROCdisplay`files
1510PROCvalues
1520ENDPROC
1530:
1540REM
1550REM" Error reporting
1560REM
1570DEFPROCerror
1580*FX3
1590IFERR=17THENENDPROC
1600VDU26,28,0,23,39,4,12,7
1610PRINT" An unexpected error has caus
ed"'" the program to hault:"
1620VDU26
1630FORAS=7TO10:PRINTTAB(0,AS);" ";:NEX
T
1640VDU28,2,10,39,7,12
1650REPORT:PRINT;" at line ";ERL;
1660VDU26,31,0,10
1670PRINT'" Please report the error to
8-Bit as"'" soon as possible..."
1680PROCkey
1690PROCset`drive(0)
1700ENDPROC
1710:
1720REM
1730REM" Input routine for source/
1740REM" destination drives
1750REM
1760DEFPROCinput(text$,forbid$)
1770VDU23;82090;0;0;0;
1780REPEAT
1790G$=GET$
1800UNTILINSTR(forbid$,G$)=0
1810IFG$=CHR$(13)THENG$=""
1820PROCoff
1830ENDPROC
1840:
1850REM
1860REM" Titles etc.
1870REM
1880DEFPROCtitle
1890FORK=0TO1
1900PRINTTAB(0,K);" ";CHR$157;CHR$141"
Tree Rename Version 2.01"
1910NEXT
1920PRINTSPC(7);ren$;"Written by Alex S
avvides"
1930PROCblu(" An 8-Bit Public Domain U
tility")
1940VDU28,0,23,39,4
1950ENDPROC
1960:
1970REM
1980REM" Initialise variables
1990REM
2000DEFPROCinit
2010IFTOP-2<>20595 THENSOUND1,-15,50,2:
PRINT'"This is not an original version."
''"The program has been changed and may
"'"not run correctly. I advise that you
"'"obtain an un-altered version for your
"'"own protection.":END
2020NA=0
2030*FX4 1
2040title$=""
2050bar$=CHR$132+CHR$157
2060tag$=CHR$131
2070untag$=CHR$135
2080ren$=CHR$134
2090no$=CHR$129
2100menu=1
2110PROCclear`tags
2120PROCset`drive(0)
2130S$="":D$=""
2140*FX11
2150CLOSE#0
2160PROCclr`mem
2170x=0:y=0
2180ENDPROC
2190:
2200REM
2210REM" Cursor off
2220REM
2230DEFPROCoff
2240VDU23;8202;0;0;0;:ENDPROC
2250:
2260REM
2270REM" Tag file
2280REM
2290DEFPROCmark`file
2300IFLEFT$(file$(hilited),1)=D$THENVDU
7:ENDPROC
2310IFmark$(hilited)=untag$THENmark$(hi
lited)=tag$:ENDPROC
2320IFmark$(hilited)=tag$THENmark$(hili
ted)=untag$
2330ENDPROC
2340:
2350REM
2360REM" Main work-screen
2370REM
2380DEFPROCwork`screen
2390S$="":D$=""
2400VDU26,12
2410:
2420PROCtitle
2430PROCcols
2440PROCcommands
2450PROCvals
2460PROCvalues
2470PROCdisplay`files
2480:
2490hilited=1
2500:
2510REPEAT
2520*FX202 32
2530PROCoff
2540PRINTTAB(x,y);bar$;mark$(hilited);
2550xx=x:yy=y
2560H=GET
2570IFH=32THENH=68:GOTO2840
2580IFH=49THENmenu=2:PROCcommands
2590IFH=72THENmenu=1:PROCcommands
2600IFH=42THENPROCos`command:GOTO2840
2610IFH=136ANDx<>0THENx=x-13:PROCcursor
`pos:GOTO2630
2620IFH=136ANDx=0ANDy<>0THENx=26:y=y-1:
PROCcursor`pos
2630IFH=137ANDhilited=B%THENGOTO2670
2640IFH=137ANDx=26THENy=y+1:x=0:PROCcur
sor`pos:GOTO2670
2650IFH=137THENx=x+13:PROCcursor`pos
2660IFH=138ANDy<>MAXANDfile$(hilited+3)
<>""THENy=y+1:PROCcursor`pos
2670IFH=139ANDy<>0THENy=y-1:PROCcursor`
pos
2680IFH=136ORH=137ORH=138ORH=139THENGOT
O2830
2690:
2700:
2710IFH=13PROCmark`file:PROCvalues:PROC
cursor`pos
2720IFH=83THENPROCinput`source:PROCvalu
es
2730IFH=68THENPROCinput`drive:PROCvalue
s
2740IFH=67THENPROCclear`CYAN`tags
2750IFH=82THENPROCinput`rename:PROCvalu
es
2760IFH=84THENPROCtag`all
2770IFH=85THENPROCuntag`all(1)
2780IFH<>71GOTO2800
2790IFH=71THENIFFNcheck`vars<>1THENPROC
rename`files:PROCvalues
2800:
2810PROCmessage("Select file(s) or key
a command:",0)
2820VDU28,0,17,39,7
2830PRINTTAB(xx,yy);" ";CHR$156;
2840UNTILH=68ORH=81ORH=42
2850IFH=42THENGOTO2400
2860ENDPROC
2870:
2880REM
2890REM" Keep track of where high-
2900REM" light bar is on screen
2910REM
2920DEFPROCcursor`pos
2930IFH=136THENhilited=hilited-1
2940IFH=137THENhilited=hilited+1
2950IFH=139THENhilited=hilited-3
2960IFH=138THENhilited=hilited+3
2970ENDPROC
2980:
2990REM
3000REM" Confirmation....
3010REM
3020DEFFNare`you`sure
3030PROCmessage("Rename tagged files? (
Y/N) :",0)
3040REPEAT
3050YES$=GET$
3060UNTILINSTR("YyNn",YES$)
3070IFINSTR("Nn",YES$)THEN=0
3080=-1
3090:
3100REM
3110REM" Press a key...
3120REM
3130DEFPROCkey
3140VDU26
3150PROCblu("Tap a key to return to wor
k-screen")
3160key=GET
3170ENDPROC
3180:
3190REM
3200REM" Sort files alphabetically
3210REM
3220DEFPROCsort
3230PRINT" Sorting files ";
3240temp$=""
3250IFB%=1THENENDPROC
3260FORtop=1TOB%
3270smallest=top
3280FORtest=topTOB%
3290f$=MID$(file$(top),2,LEN(file$(top)
))
3300IFMID$(file$(test),3,1)<=MID$(file$
(smallest),3,1)THENsmallest=test
3310NEXTtest
3320temp$=file$(top)
3330mtemp$=mark$(top)
3340file$(top)=file$(smallest)
3350mark$(top)=mark$(smallest)
3360file$(smallest)=temp$
3370mark$(smallest)=mtemp$
3380NEXTtop
3390PRINT"done"
3400ENDPROC
3410:
3420REM
3430REM" Tag all files
3440REM
3450DEFPROCtag`all
3460S$=""
3470FORpass=1TOB%
3480IFLEFT$(file$(pass),1)<>D$ANDmark$(
pass)<>ren$ANDmark$(pass)<>no$THENmark$(
pass)=tag$
3490NEXT
3500PROCdisplay`files
3510PROCvalues
3520ENDPROC
3530:
3540REM
3550REM" Untag all
3560REM
3570DEFPROCuntag`all(opt)
3580FORpass=1TOB%
3590IFmark$(pass)<>ren$ANDmark$(pass)<>
no$THENmark$(pass)=untag$
3600NEXT
3610IFopt=0THENENDPROC
3620PROCdisplay`files
3630PROCvalues
3640ENDPROC
3650:
3660REM
3670REM" Input directory to rename
3680REM" files to
3690REM
3700DEFPROCinput`rename
3710PROCmessage("Enter dest. directory
: ",0)
3720PRINTTAB(27,20);
3730PROCinput("",""":. "):D$=G$
3740IFS$=D$THENPROCcode(2):D$="":ENDPRO
C
3750PROCoff
3760ENDPROC
3770:
3780REM
3790REM" Input directory to rename
3800REM" files from
3810REM
3820DEFPROCinput`source
3830PROCmessage("Enter source directory
:",0)
3840PRINTTAB(27,20);
3850PROCinput("",""":. "):S$=G$
3860PROCoff
3870IFD$=S$THENPROCcode(2):S$="":ENDPRO
C
3880PROCuntag`all(0)
3890PROCtagit:PROCdisplay`files
3900ENDPROC
3910:
3920REM
3930REM" Display current values
3940REM
3950DEFPROCvals
3960VDU26
3970PRINTTAB(0,18);STRING$(38," ");
3980PRINTTAB(0,19);STRING$(38," ");
3990PRINTTAB(0,20);STRING$(38," ");
4000PRINTTAB(2,18);"TOTAL: TAGGED:
N/A : "
4010PRINTTAB(2,19);"DRIVE: SOURCE: "
4020PRINTTAB(22,19);" RENAME: "
4030ENDPROC
4040:
4050REM
4060REM" Update and display values
4070REM
4080DEFPROCvalues
4090VDU26
4100PRINTTAB(9,18);" "
4110PRINTTAB(9,18);B%;" "
4120PRINTTAB(20,18);" "
4130PRINTTAB(20,18);FNtagged
4140PRINTTAB(32,18);" "
4150PRINTTAB(32,18);NA
4160PRINTTAB(9,19);" "
4170PRINTTAB(9,19);dr$
4180PRINTTAB(20,19);" "
4190PRINTTAB(20,19);S$
4200PRINTTAB(32,19);" "
4210PRINTTAB(32,19);D$
4220PROCmessage("Select file(s) or key
a command:",0)
4230VDU28,0,17,39,7
4240ENDPROC
4250:
4260REM
4270REM" Count tagged files
4280REM
4290DEFFNtagged
4300tag=0
4310FORcount=1TOB%
4320IFmark$(count)=tag$THENtag=tag+1
4330NEXT
4340=tag
4350:
4360REM
4370REM" Input drive specification
4380REM
4390DEFPROCinput`drive
4400PRINTTAB(10,11);
4410PROCmessage("Enter drive to use : "
,0)
4420REPEAT:drv$=GET$:UNTILINSTR("0123",
drv$)
4430PROCset`drive(VAL(drv$))
4440PROCvalues
4450ENDPROC
4460:
4470REM
4480REM" Validate source/rename
4490REM" directories
4500REM
4510DEFFNcheck`vars
4520PROCmessage("Please wait...",0)
4530IFLEN(S$)=1ANDLEN(D$)=1THENGOTO4580
4540IFFNtagged=0THENPROCcode(1):=1
4550IFS$=""ANDD$<>""ANDFNtagged<>0THENP
ROCuntag`matching:GOTO4580
4560IFS$=""ANDD$=""THENPROCcode(3):=1
4570IFFNtagged>0ANDD$=""THENPROCcode(5)
:=1
4580=0
4590:
4600REM
4610REM" Message displays
4620REM
4630DEFPROCmessage(TEXT$,KEY)
4640VDU26
4650IFKEY=2THENADD$="Error: "ELSEADD$="
"
4660PRINTTAB(0,20);STRING$(39," ");
4670PRINTTAB(0,20);" ";CHR$157" ";ADD$;
" ";TEXT$;
4680IFKEY=0THENPRINT" ";CHR$156;:ENDPRO
C
4690*FX15 1
4700KEY$=INKEY$(150)
4710PRINTTAB(0,20);STRING$(36," ");
4720ENDPROC
4730:
4740REM
4750REM" Untag tagged files
4760REM
4770DEFPROCclear`CYAN`tags
4780FORuntag=1TOB%
4790IFmark$(untag)=ren$THENmark$(untag)
=untag$
4800NEXTuntag
4810VDU26
4820IFmenu=2THENPRINTTAB(22,22);" "
4830PROCdisplay`files
4840ENDPROC
4850:
4860REM
4870REM" Tag selected file
4880REM
4890DEFPROCtagit
4900found=0
4910FORfind=1TOB%
4920IFLEFT$(file$(find),1)=S$ANDmark$(f
ind)<>ren$ANDmark$(find)<>no$THENmark$(f
ind)=tag$:found=found+1
4930NEXT
4940IFfound=0THENPROCcode(4):S$="":PROC
values
4950ENDPROC
4960:
4970REM
4980REM" Check that file being
4990REM" renamed does not appear
5000REM" in another directory.
5010REM
5020DEFFNms(check$)
5030LOCALF:LOCALT
5040F=FALSE
5050T=0:REPEAT
5060T=T+1
5070IFfile$(T)=D$+MID$(check$,2,LEN(che
ck$))THENPROCmessage(D$+MID$(check$,2,LE
N(check$))+" exists!",1):mark$(ren)=unta
g$:F=TRUE:PROCmessage("Please wait...",0
)
5080UNTILT=B%ORF=TRUE
5090IFF=TRUETHEN=TRUE
5100=FALSE
5110:
5120REM
5130REM" Check for duplicate file-
5140REM" names regardless of
5150REM" directory
5160REM
5170DEFPROCtreb(check$)
5180FORpass=1TOB%
5190IFMID$(check$,3,LEN(check$))=MID$(f
ile$(pass),3,LEN(file$(pass)))ANDpass<>r
enTHENmark$(pass)=no$
5200NEXTpass
5210ENDPROC
5220:
5230REM
5240REM" See REM(s) for PROCtreb
5250REM
5260DEFPROCnot`available
5270PRINT" Finding un-available files";
5280NA=0
5290FORa=1TOB%
5300FORb=a+1TOB%
5310:
5320IFMID$(file$(a),3,LEN(file$(a)))=MI
D$(file$(b),3,LEN(file$(b)))ANDfile$(a)<
>file$(b)THENmark$(b)=no$
5330NEXTb
5340NEXTa
5350:
5360FORcount=1TOB%
5370IFmark$(count)=no$THENNA=NA+1
5380NEXT
5390PRINT;" ";NA;" found"
5400ENDPROC
5410:
5420REM
5430REM" Untag any files that match
5440REM" the source directory
5450REM
5460DEFPROCuntag`matching
5470FORTT=1TOB%
5480IFmark$(TT)<>tag$THENGOTO5500
5490IFLEFT$(file$(TT),1)=S$THENmark$(TT
)=untag$
5500NEXT:ENDPROC
5510:
5520REM
5530REM" *DRIVE selected drive
5540REM
5550DEFPROCset`drive(drive)
5560dr$=STR$(drive)
5570OSCLI"DRI. "+dr$
5580ENDPROC
5590:
5600REM
5610REM" Display files on screen
5620REM
5630DEFPROCdisplay`files
5640C=0
5650VDU28,0,17,39,7,30
5660FORY=1TOB%
5670PRINT;" ";mark$(Y);file$(Y);SPC(12
-LEN(file$(Y)+" "));CHR$156;:C=C+1
5680IFC=3THENPRINT';:C=0
5690NEXTY
5700:
5710x=0:y=0:hilited=1
5720MAX=INT(B%/3)
5730VDU28,0,17,39,7
5740ENDPROC
5750:
5760DEFPROCsearch
5770ex=-13:wi=0
5780FORR=1TOren
5790ex=ex+13
5800IFex=39THENwi=wi+1:ex=0
5810NEXT
5820ENDPROC
5830:
5840REM
5850REM" Convert filenames held in
5860REM" array to upper case
5870REM
5880DEFFNupcase($p%)
5890LOCALA%,B%,L%,Z%
5900A%=ASC"a":Z%=ASC"z"
5910FORL%=0TOLEN($p%)-1:B%=p%?L%
5920IFB%>=A%IFB%<=Z%p%?L%=B%AND&5F
5930NEXT:=$p%
5940:
5950REM
5960REM" Total tagged files
5970REM
5980DEFFNcount`tagged
5990any=0
6000FORT=1TOB%
6010IFmark$(T)<>tag$THENGOTO6030
6020IFLEFT$(file$(T),1)=D$THENany=any+1
6030NEXT
6040=any
6050:
6060REM
6070REM" No files available for
6080REM" renaming
6090REM
6100DEFPROCno`files
6110VDU28,0,17,39,4,12
6120ONERRORCALL!-4
6130PRINTren$"There are no files on thi
s drive!"'
6140PRINTtag$"Please insert another dis
k, and/or"
6150PRINTtag$"enter a new drive no.:"
6160PRINT'" Enter new drive (ESCAPE TO
QUIT) : "
6170REPEAT
6180DR$=GET$
6190UNTILINSTR("0123",DR$)
6200PROCset`drive(VAL(DR$))
6210ENDPROC
6220:
6230REM
6240REM" Clear tagged files
6250REM
6260DEFPROCclear`tags
6270FORpass=1TO31:mark$(pass)=untag$:NE
XTpass
6280ENDPROC
6290:
6300REM
6310REM" Input O.S. Command
6320REM
6330DEFPROCos`command
6340VDU26,28,0,23,39,4,12
6350INPUT" Enter command: *"OS$
6360CLS
6370OSCLIOS$
6380PROCkey
6390ENDPROC
6400:
6410REM
6420REM" Display 'renaming' text
6430REM
6440DEFPROChelp`menu
6450VDU26,28,0,23,39,21,12,30,26
6460PRINTTAB(0,22);" <TAB> terminate (r
esponse may not be"
6470PRINTTAB(18,23);"immediate)."
6480PROCmessage(" Remaining : out of
",0)
6490VDU26:ENDPROC
6500:
6510REM
6520REM" Blank &0E08 - &0F00:
6530REM" Area of memory reserved
6540REM" for catalogue (DFS only)
6550REM
6560DEFPROCclr`mem
6570FORmem=&0E08TO&F00
6580?mem=0
6590NEXT:ENDPROC
6600:
6610REM" C o l o u r guide
6620REM
6630DEFPROCcols
6640VDU12,26
6650PRINTTAB(3,4);" WHITE:untagged YEL
LOW:tagged"
6660PRINTTAB(3,5);" CYAN:renamed RED
:not available"
6670PRINTTAB((40-LEN("Disk title: "+tit
le$+" "))/2);" ";CHR$157" Disk tit
le: '";title$;"' ";CHR$156
6680ENDPROC
6690:
6700REM
6710REM" Commands
6720REM
6730DEFPROCcommands
6740VDU26,28,0,23,39,21,30,12
6750IFmenu=2THENGOTO6810
6760CLS
6770PRINT" (Cursor keys) move highligh
t bar"
6780PRINT" (RETURN) tag/untag fil
e"
6790PRINT" (1) command summa
ry";
6800GOTO6860
6810CLS
6820PRINT" (T)ag all (U)ntag all (D)ri
ve (G)o"
6830PRINT" (S)ource (R)ename (C)le
ar (*) Os"
6840PRINT" (Q)uit (SPC) Re-cat (H)el
p Menu";
6850IFFNcount`tag=1THENPRINTTAB(22,1);"
";TAB(31,1);" ";
6860ENDPROC
6870:
6880REM" Checks to see that any
6890REM" files tagged are not any
6900REM" in the destination directory
6910REM" This saves times renaming
6920REM" files to themselves!!!
6930REM
6940DEFPROCdubcheck
6950FORcheck=1TOB%
6960IFLEFT$(file$(check),1)=D$ANDmark$(
check)=tag$THENmark$(check)=untag$
6970NEXT
6980PROCdisplay`files
6990PROCvalues
7000ENDPROC
7010:
7020REM
7030REM" Totals tagged files
7040REM
7050DEFFNcount`tag
7060found=0
7070FORtotal=1TOB%
7080IFmark$(total)=ren$THENfound=found+
1
7090NEXT
7100IFfound>0THEN=1ELSE=0
7110:
7120REM
7130REM" Yellow text on blue
7140REM" highight bar ...
7150REM
7160DEFPROCblu(blu$)
7170ASD=LEN(blu$)+3
7180VDU26
7190PRINTTAB(0,24);" ";CHR$157;" ";blu$
;STRING$(39-ASD," ");
7200ENDPROC
7210:
7220:
7230REM" Checks whether machine is
7240REM" a BBC Master and displays
7250REM" message if it is
7260REM
7270DEFPROCmaster
7280IFINKEY(-256)<>253THENENDPROC
7290PRINT'"There is no guarantee that T
ree Rename"
7300PRINT"works on a BBC Master - you h
ave"
7310PRINT"been warned !"
7320key=INKEY(250)
7330CLS
7340ENDPROC
7350:
7360REM
7370REM" Program error codes
7380REM
7390DEFPROCcode(err)
7400IFerr=1THENPROCmessage("No file(s)
selected",2)
7410IFerr=2THENPROCmessage("Source & re
name must differ",2)
7420IFerr=3THENPROCmessage("Source/Rena
me directories?",2)
7430IFerr=4THENPROCmessage("No files in
'"+S$+"' directory",2)
7440IFerr=5THENPROCmessage("Rename dire
ctory?",2)
7450ENDPROC
7460:
7470REM
7480REM" Read disk title from memory
7490REM
7500DEFPROCget`title
7510PRINT" Getting disk title ";
7520T%=&0DFF:T$="":al=T%:C$=""
7530REPEAT
7540al=al+1
7550IFFNchar(?al)=0THENT$=T$+"?"ELSET$=
T$+C$
7560UNTILal=&0E07
7570T%=&0EFF:al=T%:C$=""
7580REPEAT
7590al=al+1
7600IFFNchar(?al)=0THENT$=T$+"?"ELSET$=
T$+C$
7610UNTILal=&0F03
7620title$=T$
7630IFtitle$=STRING$(12,"?")THENtitle$=
"<untitled>"
7640PRINT"done"
7650ENDPROC
7660:
7670REM
7680REM" Compare chars in disk title
7690REM" to valid ASCII chars in
7700REM" range 31 - 126
7710REM
7720DEFFNchar(char)
7730chars=31
7740REPEAT
7750chars=chars+1
7760UNTILCHR$(char)=CHR$(chars)ORchars=
126
7770IFCHR$(char)=CHR$(chars)THENC$=CHR$
(char):=1
7780IFchars=126THEN=0
7790ENDPROC