HDRen

100 REMark WIN hard disk rename
110 REMark pjwitte 1998
120 REMark V0.03
130 :
140 ch = 1: namel% = 10: esc$ = CHR$(27)
150 CLS#ch
160 PRINT#ch; '      Rename harddisk'
170 PRINT#ch; 'Note: No other application'
180 PRINT#ch; 'may access the hard disk'
190 PRINT#ch; 'during this call'
200 PRINT#ch\\ 'Enter drive number <1..8> ';
210 CURSEN#ch
220 REPeat
230  n$ = INKEY$(#ch; -1)
240  IF n$ INSTR '12345678' & esc$: EXIT
250  BEEP 999, 999
260 END REPeat
270 CURDIS#ch: BEEP 2, 2
280 IF n$ = esc$: PRINT#ch; '^ESC': STOP
290 PRINT#ch; n$
300 w = FOPEN("win" & n$ & '_*D2d')
310 IF w = -9 THEN
320  PRINT#ch; 'HD is in use. Close all open'
330  PRINT#ch; 'channels on this drive and'
340  PRINT#ch; 'then try again.': STOP
350  ELSE : IF w < 0: ERT w
360 END IF
370 GET#w\ 0; sec$
380 n$ = sec$(1 TO 4)
390 IF n$ <> 'QLWA' THEN
400  PRINT#ch; 'Unsupported hard disk format:' !n$: CLOSE#w: STOP
410 END IF
420 n$ = sec$(7 TO 6 + namel%)
430 PRINT#ch\\ 'Current name is "'; n$; '"'
440 PRINT#ch\\'Enter new name (max'! namel%! 'chars)'
450 INPUT#ch;, n$: n% = LEN(n$)
460 IF n% = 0: PRINT#ch; 'Aborted': CLOSE#w: STOP
470 IF n% < namel%: n$ = n$ & FILL$(' ', namel% - LEN(n$))
480 FOR i% = 1 TO namel%: sec$(6 + i%) = n$(i%)
490 PRINT#ch; 'Writing...'
500 PUT#w\ 0; sec$: CLOSE#w
510 PRINT#ch\\ 'Done': BEEP 2, 2
520 :
  
Generated with sb2htm on 2019 Apr 01
©pjwitte March 2oi9