Forum Liberty Basic France

Le 07/07/2021 à 17h58

Administrateur

Groupe: Administrateur

Inscrit le: 04/03/2012
Messages: 2438
Issu du forum anglophone et sérieusement élagué. ( https://justbasiccom.proboards.com/thread/702/bas-exe-automated?page=2&scrollTo=5000 )
Code VB :
 
   '----------NOTE: You have to work in a folder---------
  nomainwin
  dim info$(10,10)
 caption$="Aller jusqu'au dossier contenant Just Basic v1.01 et double clic on"
 gosub [fenêtre]
 [ret]
  JBexe$ = "jbasic.exe"
  'JBruntime$ = "jbrun2.exe"
   JBruntime$ = "jbrun101.exe"
  DllList$="vbas31w.sll vgui31w.sll voflr31w.sll vthk31w.dll vtk1631w.dll vtk3231w.dll vvm31w.dll vvmt31w.dll"
     filedialog "Open \ Choisir un fichier (.bas) ", DefaultDir$; "\*.bas", fname$
     if fname$ = "" then wait
     fil$=fname$
     for var1 = len(fname$) to 1 step -1
       if mid$(fname$, var1, 1) = "\" then var2 = var1 -1 : var3 = var2 - ((len(fname$))) : exit for
     next var1
     var3 = abs(var3)
     orig$ = left$(fname$, var2)
     fname0$ = right$(fname$, var3 -1)
     for var4 = len(fname0$) to 1 step -1
      if mid$(fname0$, var4, 1) = "." then var5 = var4 -1 : var6 = var5 - ((len(fname0$))) : exit for
     next var4
     var6 = abs(var6)
    fnamenobas$ = left$(fname0$, var5)
  [begin]
     DestPath$=DefaultDir$
     DestPath1$=DefaultDir$;"\";fnamenobas$
     res = mkdir( DestPath1$)
  open fname$ for input as #fname
    open DestPath1$;"\";fname0$ for output as #1
      print #1, input$(#fname, lof(#fname));
    close #fname
  close #1
  JBexe$=FolderDialog$;"\";"jbasic.exe"
  print JBexe$'(((((((((((((
  print fil$'(((((((((((((
 notice,"Vous devrez faire un: '.tkn' du code qui va s'afficher."
 'notice, You will need to create a: ".tkn" code that will open.
  run   chr$( 34) + JBexe$ +chr$( 34) + " " + chr$(34) + fil$ + chr$( 34)
  open FolderDialog$;"\";JBruntime$ for input as #file
    open DestPath1$;"\";JBruntime$ for output as #1
      print #1, input$(#file, lof(#file));
    close #file
  close #1
  aa$=DestPath1$;"\";JBruntime$
  bb$=DestPath1$;"\";fnamenobas$ + ".exe"
  print aa$'**************************
  print bb$'**************************
    name aa$ as bb$
    w$ = "" : i = 0
    while 1
      i = i + 1
      w$=word$(DllList$,i)
      if w$="" then exit while
      from$=FolderDialog$;"\";w$
      to$=DestPath1$;"\";w$
      open from$ for input as #file
        open to$ for output as #1
          print #1, input$(#file, lof(#file));
        close #file
      close #1
    wend
    cc$=fnamenobas$+".tkn"
    dd$=DestPath1$;"\";fnamenobas$+".tkn"
    name cc$ as dd$
  wait
  'function FolderDialog$(caption$)
  [fenêtre]
    WindowWidth = 600: WindowHeight = 510
    UpperLeftX=100: UpperLeftY=10
    BackgroundColor$ = "lightgray"
    ForegroundColor$ = "black"
    gosub [FolderDlgGetDrives]
    statictext #folderdlg.S, "Note: - Only Drives and Folders Appear Below - No Files Appear", 45, 15, 550, 25
    statictext #folderdlg.S, "Select a Drive or a Folder From the List", 175, 40, 300, 25
    statictext #folderdlg.D, "      (Double Click Drive Letters and Folders to Select or Navigate)", 85, 70, 395, 15
    listbox #folderdlg.list, FolderList$(, [FolderDlgSelect], 22, 90, 550, 230
    button #folderdlg.default, "Ok", [FolderDlgOk], UL, 190, 393, 85, 35
    button #folderdlg.B, "Back", [FolderDlgBack], UL, 490, 45, 80, 30
   ' button #folderdlg.C, "Cancel", [FolderDlgCancel], UL, 290, 293, 85, 35
    textbox #folderdlg.text, 42, 325, 510, 30
    statictext #folderdlg.path, "Selected Drive or Folder Path Appears Here", 130, 258, 400, 20
    GRAPHICBOX #folderdlg.g, 5, 5, 585, 470
    open caption$ for window_nf as #folderdlg
    #folderdlg, "TRAPCLOSE [closeprog]"
    #folderdlg.g, "down; fill darkpink;color white; backcolor darkpink"
     #folderdlg.default, "!font Arial 10 bold"
     #folderdlg, "font Arial 10 bold"
     #folderdlg.S, "!font Arial 10 bold"
     #folderdlg.path, "!font Arial 10 bold"
     #folderdlg.list, "font Arial 10 bold"
    ' #folderdlg.C, "!font Arial 10 bold"
     #folderdlg.D, "!font Arial 8 bold"
      #folderdlg.text, "!font Arial 10 bold"
  wait
 [FolderDlgSelect]
    #folderdlg.list, "selection? temp$"
    if temp$ <> "" then
      level = level+1
      folder$ = folder$; temp$; "\"
      #folderdlg.text, folder$
      gosub [FolderDlgGetDir]
      #folderdlg.list, "reload"
    end if
  wait
  [FolderDlgBack]
    if level > 0 then
      level = level-1
        if level = 0 then
          folder$ = ""
          gosub [FolderDlgGetDrives]
        else
          i = len(folder$)-1
          while mid$(folder$, i, 1) <> "\" and mid$(folder$, i, 1) <> ""
             i = i-1
          wend
          folder$ = left$(folder$, i)
          gosub [FolderDlgGetDir]
        end if
        #folderdlg.text, folder$
        #folderdlg.list, "reload"
    end if
  wait
  [FolderDlgGetDrives]
    c = 1
    while word$(Drives$, c) <> ""
      c = c+1
    wend
    redim FolderList$(c)
    for i = 1 to c
      FolderList$(i) = word$(Drives$, i)
    next i
  return
  [FolderDlgGetDir]
    files folder$, info$(
    s = val(info$(0,0))
    t = val(info$(0,1))
    redim FolderList$(t)
    for i = 1 to t
      FolderList$(i) = info$(i+s, 1)
    next i
  return
  [FolderDlgOk]
    #folderdlg.text, "!contents? FolderDialog$"
    JBexe$=FolderDialog$+"jbasic.exe"
    If right$(FolderDialog$,1) = "\" then FolderDialog$ = left$(FolderDialog$, len(FolderDialog$) - 1)
  '[FolderDlgCancel]
  goto [ret]
  [closeprog]
    close #folderdlg
    end
 
____________________
Roro

   

 |  |

1 Utilisateur en ligne : 0 Administrateur, 0 Modérateur, 0 Membre et 1 Visiteur
Utilisateur en ligne : Aucun membre connecté
Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie