Programma di esempio TOSHORT.PRT
; TOSHORT
;
; Programma per Proteus
;
; (C) 2001-2003 Simone Zanella Productions
;
; Questo programma rinomina tutti i file corrispondenti alla specifica nel formato Dos (8 + 3 caratteri).

#!proteus -z

IF ISEMPTY(ARGV(5))
  CONSOLELN "Sintassi:  TOSHORT filespec"
  CONSOLELN ""
  CONSOLELN "Scopo: Converte tutti i nomi di file indicati in formato Dos (8 + 3 caratteri)."
  ABORT 0
FI

Path = SPLITPATH(ARGV(5))
H = DIROPEN(ARGV(5), 1)
F = IIF(NEQ(H, -1), 1, 0)
A = AVLNEW()
WHILE GT(F, 0)
  AVLSET(A, DIRLAST(H, 1), ".")
  F = DIRNEXT(H)
LOOP
DIRCLOSE(H)
AVLTRAVERSE(A, Rinomina)
ABORT 0


FUNCTION TrovaExt(nome)

P = STRRSTR(nome, ".")
IF NEQ(P, 0)
  RETURN LEFT(UPPER(STRTRAN(RESTFROM(nome, P), " ", "")), 4)
FI
RETURN ""


FUNCTION Rinomina(nome, trash)

lfnsource = _Path nome
ext = TrovaExt(nome)
nome = LEFT(STRTRAN(nome, " ", ""), 8)
dossource = _Path nome ext
pos = 1
WHILE ISFILE(dossource)
  IF LT(STRLEN(nome), 8)
    nome = nome "1"
    pos = 1
  ELSE  
    Z = LEFT(RIGHT(nome, pos), 1)
    IF LT(ASC(Z), ASC("Z"))
      N = INC(ASC(Z))
      IF LE(N, ASC("0"))
        N = ASC("1")
      ELSE
        IF AND(GT(N, ASC("9")), LT(N, ASC("A")))
          N = ASC("A")
        FI
      FI
      Z = CHR(N)
    ELSE          
      INC(@pos)
      CONTINUE
    FI
    nome = LEFT(nome, SUB(STRLEN(nome), pos)) Z RIGHT(nome, DEC(pos))
  FI
  dossource = _Path nome ext
LOOP
CONSOLELN dossource
FRENAME(lfnsource, dossource)
RETURN 0


FUNCTION SPLITPATH(pathname)

P = STRRSTR(pathname, "\\")
IF NEQ(P, 0)
  RETURN LEFT(pathname, P)
FI
RETURN ""
Indice esempi Prossimo esempio Esempio precedente Indice per argomenti Indice analitico
Midnight Lake iPhone Case Black Women Shoes Black Flat Shoes Leather Flats Black Patent Ballerinas Black Ballet Shoes Casual Shoes Black Shoes Women Balle Record Player Cufflinks Best iPhone XR Clear Cases iPhone XS/XS Max Leather Cases Sale Best iPhone 8/8 Plus Silicone Cases iPhone 7/7 Plus Cases & Screen Protector New Cases For iPhone 6/6 Plus iPhone 8 Case Sale iPhone Xr Case Online iPhone 7 Case UK Online iPhone X Case UK Sale iPhone X Case Deals iPhone Xs Case New Case For iPhone Xr UK Online Case For iPhone 8 UK Outlet Fashion Silver Cufflinks For Men Best Mens Cufflinks Outlet Online The Gold Cufflinks Shop Online Cheap Shirt Cufflinks On Sale Nice Wedding Cufflinks UK Online Top Black Cufflinks UK Online Mens Cufflinks Online Silver Cufflinks For Men Men Cufflinks UK Sale Gold Cufflinks UK Online Gold Cufflinks UK Silver Cufflinks UK Shirt Cufflinks Discount Online Mens Cufflinks Deals & Sales Girls Shoes For Dance Fashion Ballet Dance Shoes Best Ballet Flats Shoes UK Online Cheap Ballet Pointe Shoes UK Online Best Ballet Shoes Outlet Best Dance Shoes Sale Cheap Ballet Flats Sale UK Best Pointe Shoes Online UK Ballet Dance Shoes UK Shoes For Dance UK Best Ballet Slippers Shop Best Yoga Shoes Hotsell