1 REMark rename (c) Timo Salmi
2 REMark Translated into English Sat 1992 Apr 04 09:59:43
3 REMark version 1.3
4 :
100 CLEAR:kokoaika=DATE:mp=37:bon=1
110 DIM ohj$(7),tpvm$(8)
120 ohj$="RENAME":tpvm$="18.09.86"
130 p_otsake(ohj$),(tpvm$)
140 :
150 maxn=300:REMark Max number of files in directory
160 DIM mj$(mp):REMark string
170 DIM v$(mp):REMark answer
180 DIM as$(5):REMark drive
190 DIM tsto$(mp):REMark file name
200 DIM unimi$(mp):REMark new name
210 DIM hak$(maxn,mp):REMark directory
220 :
230 loytyi=0
240 muutettu=0
250 :
260 p_ikkunat
270 :
280 REPeat kysy
290  INK 7
300  PRINT"DRIVE?";
310  clb=KEYROW(0)
320  INPUT!as$
330  IF as$=="mdv1_":EXIT kysy:END IF 
340  IF as$=="mdv2_":EXIT kysy:END IF 
350  IF as$=="fdk1_":EXIT kysy:END IF 
360  IF as$=="fdk2_":EXIT kysy:END IF 
370  IF as$=="ram1_":EXIT kysy:END IF 
380  IF as$=="ram2_":EXIT kysy:END IF 
390  INK 2:p_beep1
400  PRINT"NOT mdv1_ mdv2_ fdk1_ fdk2_ ram1_ or ram2_"
410 END REPeat kysy
420 :
430 p_hakemisto:REMark (hak$->,n->)
440 IF n<1 THEN 
450  INK 2:p_beep1
460  PRINT"NO FILES"
470  STOP
480 END IF 
490 :
500 FOR i=1 TO n
510  tsto$=hak$(i)
520  j="b_dbf" INSTR tsto$
530  IF j THEN 
540   loytyi=loytyi+1
550   REPeat kysy
560    INK 7
570    unimi$=tsto$(1 TO LEN(tsto$)-5) & "_dbf"
580    PRINT"RENAME"!tsto$!"TO"!unimi$!"(Y/N)?";
590    clb=KEYROW(0)
600    INPUT!v$
610    IF v$=="y" OR v$=="n":EXIT kysy:END IF 
620    p_beep1
630   END REPeat kysy
640   IF v$=="y" THEN 
650    RENAME as$&tsto$ TO as$&unimi$
660    PRINT"NEW NAME:"!unimi$
670    muutettu=muutettu+1
680   END IF 
690  END IF 
700 END FOR i
710 :
720 PRINT\"Number of files found"!loytyi
730 PRINT"Renamed"!muutettu
740 p_valmis(1)
750 STOP
760 :
770 DEFine PROCedure p_hakemisto
2010 REMark (hak$->,n->)
2020  LOCal fl$(mp),il,lue
2030  fl$=as$&"tilaphak_tmp"
2040  DELETE fl$
2050  OPEN_NEW#4,fl$
2060  DIR#4,as$
2070  CLOSE#4
2080  OPEN_IN#4,fl$
2090  n=0:il=0
2100  REPeat lue
2110   IF EOF(#4) THEN 
2120    CLOSE#4
2130    DELETE fl$
2140    EXIT lue
2150   END IF 
2160   il=il+1
2170   INPUT#4,mj$
2180   IF il>2 THEN 
2190    IF n+1>maxn THEN 
2200     INK 2:p_beep1
2210     PRINT"DIRECTORY TOO BIG"
2220     STOP
2230    END IF 
2240    IF NOT mj$=="tilaphak_tmp" THEN 
2250     n=n+1
2260     hak$(n)=mj$
2270    END IF 
2280   END IF 
2290  END REPeat lue
2300 END DEFine p_hakemisto
2310 :
17000 DEFine PROCedure p_ikkunat
17010  WINDOW#1,levl%,192,al%, 37
17020  WINDOW#0,levl%, 27,al%,229
17030  PAPER#1,0:BORDER#1,1,4:CSIZE#1,1,0:CLS#1
17040  PAPER#0,0:CSIZE#0,1,0:CLS#0
17050 END DEFine p_ikkunat
17060 :
19000 DEFine PROCedure p_beep1
19010  IF bon:BEEP 4000,70:END IF 
19020 END DEFine p_beep1
19030 :
20000 DEFine PROCedure p_otsake(ohj$,tpvm$)
20010  LOCal il1%,il2%,cl%
20020  MODE 4:cl%=3:levl%=448
20030  al%=INT((512-levl%)/2)
20040  WINDOW 512,256,0,0:PAPER 0:CLS
20050  OPEN#cl%,con_:WINDOW#cl%,levl%,22,al%,16
20060  PAPER#cl%,0:CLS#cl%
20070  BORDER#cl%,1,4:CSIZE#cl%,3,1
20080  CURSOR#cl%,5,0:INK#cl%,4:PRINT#cl%,ohj$
20090  il2%=levl%-16*LEN(tpvm$)-4
20100  il1%=(il2%+16*LEN(ohj$)-155)/2
20110  INK#cl%,7:CURSOR#cl%,il1%,0
20120  PRINT#cl%,"T";"i";"mo ";"S";"al";"mi"
20130  INK#cl%,2:CURSOR#cl%,il2%,0
20140  PRINT#cl%,tpvm$:CLOSE#cl%
20150 END DEFine p_otsake
20160 :
30000 DEFine PROCedure p_valmis(ch%)
30010  LOCal tl,ml,sl
30020  PRINT#ch%,"READY,"!"elapsed"!"time"!;
30030  sl=DATE-kokoaika
30040  tl=INT(sl/3600):sl=sl-tl*3600
30050  ml=INT(sl/60):sl=sl-60*ml
30060  IF tl>0 THEN PRINT#ch%,tl!"h"!;
30070  IF ml>0 OR tl>0 THEN PRINT#ch%,ml!"min"!;
30080  PRINT#ch%,sl!"sec"
30090 END DEFine p_valmis
30100 :
31000 DEFine PROCedure reset(i)
31010  LOCal il:MODE i
31020  WINDOW 513,256,0,0:PAPER 0:CLS
31030  OPEN#2,con_:WINDOW#2,448,200,32,16
31040  PAPER#2,1:INK#2,7
31050  WINDOW#0,448,40-(i=4),32,216+(i=4)
31060  WINDOW 448+8*(i=4),200+2*(i=4),32-4*(i=4),16-(i=4)
31070  PAPER 2*(i=8):BORDER (i=4),4*(i=4)
31080  FOR il=0,1,2:CSIZE#il,(i=4)+2*(i=8),0:END FOR il
31090  PAPER#0,0:INK#0,7-3*(i=0):INK 7:CLS
31100  SCALE 100,0,0:FILL 0
31110 END DEFine reset
31120 :
31990 STOP
32000 vsave 1:STOP
32010 vsave 2:STOP
32020 vsave 3:STOP
32030 vsave 4:STOP
32040 vsave 5:STOP
32050 vsave 6:STOP
32060 DEFine PROCedure vsave(dr)
32070  LOCal avl$(42),bvl$(42),dvl$(6,5):avl$="rename"
32080  bvl$=DATE$:bvl$=bvl$(1 TO 4)
32090  IF bvl$<>1992 THEN 
32100   PRINT#0,DAY$!DATE$!"Not saved, set SDATE"
32110   BEEP 4000,12:STOP:END IF 
32120  ver1%=1:ver2%=3
32130  dvl$(1)="mdv1_":dvl$(2)="mdv2_"
32140  dvl$(3)="fdk1_":dvl$(4)="fdk2_"
32150  dvl$(5)="ram1_":dvl$(6)="ram2_"
32160  bvl$=dvl$(dr)&avl$
32170  DELETE bvl$:OPEN_NEW#3,bvl$:ver%=ver2%+1
32180  PRINT#3,"1 REMark ";avl$!"(c) Timo Salmi"
32190  PRINT#3,"2 REMark ";DAY$!DATE$
32200  PRINT#3,"3 REMark version"!ver1%;".";ver%
32210  PRINT#3,"4 :"
32220  LIST#3,100 TO 32110
32230  PRINT#3,"32120  ver1%=";ver1%;":ver2%=";ver%
32240  LIST#3,32130 TO:CLOSE#3
32250  PRINT#0,"Saved"!bvl$!"version"!ver1%;".";ver%
32260 END DEFine vsave
