Bas Finder Contest

Upload your Just BASIC Challenge and Contest Entries here.
Post Reply
John Davidson
Site Admin
Posts: 128
Joined: Sat Nov 13, 2004 8:36 am
Location: Vashon Wa
Contact:

Bas Finder Contest

Post by John Davidson »

Upload your entrie here.
John Davidson
e-me: johnshomeport@yahoo.com
My JB Page: http://john.jbusers.com/
Did ya Libby yet? http://lblibby.com/
Crusader
Posts: 7
Joined: Tue Mar 25, 2008 7:17 pm

Bas Finder

Post by Crusader »

My Entry for the Contest....


Updated...


Bug Fixes/ Updates:

-No Problem Saving Scans
-Delete Feature
-BackgroundColor$ Problem Fixed.
-loading file fixed
Attachments
bas finder (after entry).zip
Updated.
(7.42 KiB) Downloaded 1187 times
Last edited by Crusader on Tue Apr 01, 2008 12:32 am, edited 4 times in total.
Crusader
uncleBen
Posts: 63
Joined: Sat Oct 29, 2005 9:03 pm

Post by uncleBen »

My unofficial response to the challenge.

Just for fun. Not competing for the prizes.

Edit: forgot to include a folder called "Data".
Edit2: more bug-fixes.
Attachments
foobar.zip
Includes the Data directory where the program stores its files.
(15.84 KiB) Downloaded 1133 times
Last edited by uncleBen on Thu Mar 27, 2008 8:23 pm, edited 1 time in total.
SirDavid
Posts: 6
Joined: Thu Feb 21, 2008 12:28 pm

Post by SirDavid »

I made a very simple entry. It isn't very fancy, but it does the job and is nice and short. Enjoy!

P.S. Crusader and UncleBen, your entries were excellent! They are very polished and professional programs.

EDIT2: Changed some stuff

EDIT:Uh-oh, it doesn't work when I download it! Retrying... No way! I'll remove the spaces... didn't work... Do I have to post it unzipped maybe? Maybe it's a good thing it's small...
It won't let me add a bas file!! Now I guess I'll have to post the code. Here it is, sorry for all the trouble:

Code: Select all

'This is a free program. You may edit it, distribute
'it, and modify it as you see fit.

'This program is used to display comments in front of bas files in any folder.

global theirFolder$, emptyFile, bopen, copen       'Make global variables

nomainwin                             'Have no main window
dim info$(10, 10)                     'Make all the arrays
    dim folders$(10000)
    dim filesFolders$(10, 10)
    dim basFiles$(10000, 2)
    dim inListbox$(10000)
    inListbox$(1)="None"              'Display "none" in our listbox
    WindowWidth=600                   'Build GUI
    WindowHeight=600
    listbox #a.1, inListbox$(), [whichbas], 10, 40, 200, 500
    texteditor #a.2, 220, 40, 370, 500
    statictext #a.3, "Select a folder and I will find the bas files in it and display the comments"_
    +" in front of the bas files.", 5, 5, 450, 20
    button #a.4, "Choose folder", [choose], UL, 460, 5
    open "Bas file comment finder" for window as #a
    print #a.1, "singleclickselect"
    print #a, "trapclose quita"
    wait                             'Let the user start when they are ready

[choose]                             'Allow the user to pick a folder
    call userPickFolder$             'Call folder-picking function
    redim basFiles$(10000, 2)        'Reset relevant arrays
    redim inListbox$(10000)
    emptyFile=0                      'This number holds the amount of known files
    print #a.4, "!disable"           'The user cannot click the button while searching for files
    call recursiveFind theirFolder$  'Find the files
    print #a.4, "!enable"            'Reenable the button
    print #a.1, "reload"             'Fill the listbox
    wait                             'Let the user continue when ready

[whichbas]                                       'Let user view comments
    print #a.1, "selectionindex? whichprint"     'Get which file was selected
    putInBox$=basFiles$(whichprint, 2)           'Get the string to put in texteditor
    print #a.2, "!cls"                           'Clear texteditor

[redoa]                         'Parse string for texteditor-it won't print carriage returns
    pos=instr(putInBox$, chr$(13))              'Find first carriage return
    if pos=0 then                               'If there are none, just leave
        print #a.2, putInBox$ 
        goto[finished]
    end if
    print #a.2, left$(putInBox$, pos-1)         'Put the current part of the string in the textbox
    putInBox$=right$(putInBox$, len(putInBox$)-pos)   'Remove already parsed parts of the string
    goto[redoa]                                 'Loop back

[finished]
    wait                                        'Wait for the user

sub userPickFolder$ 
    WindowWidth=600                             'Build GUI
    WindowHeight=600
    listbox #b.1, folders$(), [selectfolder], 10, 10, 150, 500
    button #b.2, "Back out", [outone], UL, 170, 10
    button #b.3, "Select", [gotfolder], UL, 170, 50
    open "Pick a folder" for window as #b
    bopen=1                                     'b is open
    curFolder$=DefaultDir$                      'Get current folder

[mainLoop]                                               'Display folders in current folder
    if len(curFolder$)=2 then curFolder$=curFolder$+"\"  'If we are at the main drive add a \
    redim folders$(10000)                                'Redim relevant arrays
    redim info$(10, 10)
    files curFolder$, info$()                            'Put files into info$ 
    fileAmount=val(info$(0, 0))                          'Get file/folder quantities
    folderAmount=val(info$(0, 1))
    folderEmpty=1                                        'Remember first empty folder position
    for i=fileAmount+1 to fileAmount+folderAmount        'Loop through folders-don't display files
        folderName$=info$(i, 1)                          'Get folder's name
        folders$(folderEmpty)=folderName$                'Remember the name
        folderEmpty=folderEmpty+1                        'Go to next empty folder
    next
    print #b.1, "reload"                                 'Refill the listbox
    wait

[selectfolder]                                           'Let user select a folder
    print #b.1, "selection? folderchoice$"               'Get the folder
    if len(curFolder$)>3 then curFolder$=curFolder$+"\"+folderchoice$   'Find new path
    if len(curFolder$)=3 then curFolder$=curFolder$+folderchoice$   'Fixes an issue of when we are in the main drive
    goto [mainLoop]           'Display new folders

[outone]                    'Back out of folder
    for i=len(curFolder$) to 1 step -1             'Track back looking for backslashes
        if mid$(curFolder$, i, 1)="\" then         'Reached backslash?
            curFolder$=left$(curFolder$, i-1)      'If so, we can get the new folder and leave.
            exit for
        end if
    next
    goto [mainLoop]           'Display new folders

[gotfolder]         'The user has selected a folder-get it
    theirFolder$=curFolder$    'Here we are!
    close #b                  'Close window
    bopen=0                   'b is closed
end sub                        'Leave

sub recursiveFind folder$                     'Recursively find folders
    redim filesFolders$(10000, 10)            'Redim array that holds files/folders
    files folder$, "*.bas", filesFolders$()   'Get files/folders
    numFiles=val(filesFolders$(0, 0))         'Get quantities of files and folders
    numFolders=val(filesFolders$(0, 1))
    for i=1 to numFiles                       'Loop through files
        scan    'Check for user input
        name$=filesFolders$(i, 0)             'Get current file's name
        emptyFile=emptyFile+1             'Increment variable holding number of bas files
        inListbox$(emptyFile)=name$       'Put it in our listbox array of just names
        basFiles$(emptyFile, 1)=name$     'Get the name into list of names AND comments
        basFiles$(emptyFile, 2)=extractComments$(folder$+"\"+name$) 'Get comment with function
    next
    for i=numFiles+1 to numFiles+numFolders 'Empty filesFolders$ into string, it will be modified
        scan    'Check for user input
        string$=string$+folder$+"\"+filesFolders$(i, 1)+chr$(13)     'Add current filepath
    next
    for i=1 to numFolders                                 'Look through and call recursively
        scan    'Check for user input
        call recursiveFind word$(string$, i, chr$(13))    'Recurse
    next
end sub                                                   'Leave

function extractComments$(name$)                          'Function to get comments from bas
    open name$ for input as #c                            'Open bas
    copen=1                    'c is open

[redo]                                   'This loop checks through each line for non-comments
    if eof(#c)=-1 then                   'If we have reached the end of the file, leave
        close #c                         'Close file
        copen=0                          'c is closed
exit function                            'Exit
    end if
    line input #c, curLine$              'Get the next line
    char$=mid$(trim$(curLine$), 1, 1)    'Get first character discounting spaces
    if char$<>"'" and char$<>"" then     'These are the only non-command characters available
        close #c                         'Close file-we are done as this is not a comment
        copen=0                          'c is closed
exit function                            'Exit
    end if
    extractComments$=extractComments$+curLine$+chr$(13)    'Add comment or empty line
    goto[redo]                           'Loop back
end function

sub quita handle$ 
    close #a
    if bopen=1 then close #b  'b is open, close it
    if copen=1 then close #c  'c is open, close it
    end
end sub
It worked on copy-paste! Maybe the zip/unzipper doesn't like it.
Last edited by SirDavid on Thu Mar 27, 2008 10:04 pm, edited 1 time in total.
cundo
Posts: 20
Joined: Wed Mar 12, 2008 11:12 pm

Post by cundo »

:arrow: My entry, and my first file uploaded here :D :roll:

EDIT: Update Apr 1st, 2008
EDIT2: removed old version from zip
Attachments
[jb]BasFinder.zip
My entry to the contest. Two files zippped (source-code and one bmp)
(17.35 KiB) Downloaded 1237 times
Last edited by cundo on Tue Apr 01, 2008 9:24 pm, edited 2 times in total.
JosephE
Posts: 5
Joined: Wed Mar 26, 2008 2:39 am

JosephE's Entry

Post by JosephE »

My Entry: Just Liberty BASIC File Browser

EDIT: I updated this April 1st, 2008.
EDIT: Updated again at 5:33 CST.

Download:
Attachments
JLBFB.zip
Just Liberty BASIC File Browser v0.02. *Updated*
(21.33 KiB) Downloaded 1101 times
Last edited by JosephE on Tue Apr 01, 2008 10:53 pm, edited 3 times in total.
Asmodeus
Posts: 5
Joined: Fri Mar 28, 2008 3:30 pm

Bas Finder Challange

Post by Asmodeus »

Hi Everyone,

I just have not had the time to complete this, but wanted to submit what I had done.

Thanks,
-Asmodeus
Attachments
BAS Finder - Test.zip
(1.02 KiB) Downloaded 1220 times
tyilo
Posts: 3
Joined: Sat Dec 22, 2007 7:07 pm

My entry!

Post by tyilo »

Here is my entry!
Not allowed to submit bas files, so here is the code:

Code: Select all

     'This is a free program. You may edit it, distribute it, and modify it as you see fit.
     'If you modify this code, please don't delete the 2 first lines.

     NOMAINWIN

     GLOBAL LEVELS, ALL, ALLFILES

     DIM INFO$(0, 0)

[START]

     PATH$ = DefaultDir$ + "\"

     UpperLeftX = (DisplayWidth - WindowWidth) / 2

     UpperLeftY = (DisplayHeight - WindowHeight) / 2

     LISTBOX #BF.F, FOLDER$(), [WAIT], 25, 25, 150, 278

     BUTTON #BF.E, "Extend", [EXTEND], UL, 200, 50, 85, 25

     BUTTON #BF.U, "One level up", [UP], UL, 200, 100, 85, 25

     BUTTON #BF.S, "Ok", [SEARCH], UL, 200, 150, 85, 25

     BUTTON #BF.D, "Delete", [DELETE1], UL, 200, 200, 85, 25

     BUTTON #BF.N, "New", [NEW1], UL, 200, 250, 85, 25

     OPEN "Please choose a folder to search in..." FOR WINDOW AS #BF

     PRINT #BF, "TRAPCLOSE [QUIT1]"

     PRINT #BF.F, "SINGLECLICKSELECT"

     GOSUB [UPDATE1]

[WAIT]

     WAIT

[EXTEND]

     PRINT #BF.U, "!ENABLE"

     PRINT #BF.F, "SELECTION? FOLDER$"

     PATH$ = PATH$ + FOLDER$ + "\"

     GOSUB [UPDATE1]

     WAIT

[UP]

     IF LEN(PATH$) = 3 THEN
       PATH$ = ""
       A = 0
       WHILE WORD$(Drives$, A + 1) <> ""
         A = A + 1
       WEND
       DIM FOLDER$(A)
       FOR A = 1 TO A
         FOLDER$(A) = UPPER$(WORD$(Drives$, A))
       NEXT A
       PRINT #BF.F, "RELOAD"
       PRINT #BF.F, "SELECTINDEX 1"
       PRINT #BF.E, "!ENABLE"
       PRINT #BF.U, "!DISABLE"
       PRINT #BF.S, "!ENABLE"
       PRINT #BF.D, "!DISABLE"
       PRINT #BF.N, "!DISABLE"
      ELSE
       PATH$ = LEFT$(PATH$, LAST(LEFT$(PATH$, LEN(PATH$) - 1), "\"))
       GOSUB [UPDATE1]
     END IF

     WAIT

[DELETE1]

     PRINT #BF.F, "SELECTION? FOLDER$"

     QUESTION$ = "Are you sure you want to delete " + FOLDER$ + "?"

     CONFIRM QUESTION$; YN$

     IF YN$ = "no" THEN
       WAIT
     END IF

     IF RMDIR(PATH$ + FOLDER$) <> 0 THEN
       NOTICE "Could not delete "; FOLDER$; "!"
       WAIT
     END IF

     GOSUB [UPDATE1]

     WAIT

[NEW1]

     FOLDER$ = "New folder"

     PROMPT "Name of the folder:"; FOLDER$

     IF FOLDER$ = "" THEN
       WAIT
     END IF

     IF INSTR(FOLDER$, "\") <> 0 THEN
       NEW$ = FOLDER$
      ELSE
       NEW$ = PATH$ + FOLDER$
     END IF

     IF MKDIR(NEW$) <> 0 THEN
       NOTICE "Could not create "; FOLDER$; "!"
     END IF

     GOSUB [UPDATE1]

     WAIT

[UPDATE1]

     FILES PATH$, "", INFO$()

     FOLDERS = VAL(INFO$(0, 1))

     DIM FOLDER$(FOLDERS)

     FOR A = VAL(INFO$(0, 0)) + 1 TO VAL(INFO$(0, 0)) + FOLDERS
       FOLDER$(A) = INFO$(A, 1)
     NEXT A

     PRINT #BF.F, "RELOAD"

     IF FOLDERS = 0 THEN
       PRINT #BF.E, "!DISABLE"
       PRINT #BF.S, "!DISABLE"
       PRINT #BF.D, "!DISABLE"
      ELSE
       PRINT #BF.F, "SELECTINDEX 1"
       PRINT #BF.F, "SETFOCUS"
       PRINT #BF.E, "!ENABLE"
       PRINT #BF.S, "!ENABLE"
       PRINT #BF.D, "!ENABLE"
       PRINT #BF.N, "!ENABLE"
     END IF

RETURN


[SEARCH]

     PRINT #BF.F, "SELECTION? FOLDER$"

     SEARCH$ = PATH$ + FOLDER$ + "\"

     CLOSE #BF

[LEVELS]

     LEVELS$ = "All"

     PROMPT "How many levels down would you like to search in:"; LEVELS$

     IF UPPER$(LEVELS$) = "ALL" THEN
       LEVELS = -1
      ELSE
       LEVELS =  VAL(LEVELS$)
       IF LEVELS < 1 THEN
         NOTICE "Please input a valid number from 1 to all!"
         GOTO [LEVELS]
       END IF
     END IF

     CONFIRM "Would like to search after a name?"; YN$

[NAME]

     NAME$ = ""

     IF YN$ = "yes" THEN
       PROMPT "Name that you would like to search after:"; NAME$
     END IF

     IF NAME$ = "" THEN
       NAME$ = " "
     END IF

     DIM BAS$(4)

     BAS$(1) = "Please wait..."

     BAS$(2) = "If you want to stop the program, then press"

     BAS$(3) = "Ctrl+Break, and kill the program with"

     BAS$(4) = "the Just BASIC Editor."

     WindowWidth = 428

     UpperLeftX = (DisplayWidth - WindowWidth) / 2

     LISTBOX #BF.B, BAS$(), [UPDATE2], 25, 25, 258, 278

     BUTTON #BF.D, "Delete", [DELETE2], UL, 308, 25, 85, 25

     BUTTON #BF.N, "New", [NEW2], UL, 308, 75, 85, 25

     BUTTON #BF.R, "Rename", [RENAME], UL, 308, 125, 85, 25

     BUTTON #BF.DR, "Display remarks", [REMARKS], UL, 308, 175, 85, 25

     BUTTON #BF.L, "Load", [LOAD], UL, 308, 225, 85, 25

     BUTTON #BF.I, "Information", [INFO], UL, 308, 275, 85, 25

     OPEN "Bas Finder" FOR WINDOW AS #BF

     PRINT #BF, "TRAPCLOSE [QUIT1]"

     PRINT #BF.B, "SINGLECLICKSELECT"

[FILES]

     OPEN "TEMP.txt" FOR OUTPUT AS #F

     PRINT #F, "FO "; FOLDER$; "|"; LEFT$(SEARCH$, LEN(SEARCH$) - 1)

     ALL = 1

     ALLFILES = 0

     CALL FINDALL SEARCH$, 0

     CLOSE #F

     SPECIAL$ = ""

     IF ALLFILES = 0 THEN
       CLOSE #BF
       KILL "TEMP.txt"
       QUESTION$ = "No bas files found in " + SEARCH$ + "!" + CHR$(13) + "Would you like to search in another folder?"
       CONFIRM QUESTION$; YN$
       IF YN$ = "yes" THEN
         GOTO [START]
        ELSE
         END
       END IF
     END IF

     DIM FF(ALL)

     DIM BAS$(ALL)

     DIM PATH$(ALL)

     OPEN "TEMP.txt" FOR INPUT AS #F

     B = 0

     FOR A = 1 TO ALL
       LINE INPUT #F, LINE$
       BAS$ = RIGHT$(WORD$(LINE$, 1, "|"), LEN(WORD$(LINE$, 1, "|")) - 3)
       BAS$(A - B) = BAS$
       PATH$(A - B) = WORD$(LINE$, 2, "|")
       IF WORD$(LINE$, 1) = "FI" THEN
         FF(A - B) = 1
         IF INSTR(LEFT$(UPPER$(BAS$), LEN(BAS$) - 4), UPPER$(NAME$)) = 0 THEN
           BAS$(A - B) = ""
           PATH$(A - B) = ""
           B = B + 1
         END IF
        ELSE
         FF(A - B) = 0
       END IF
     NEXT A

     CLOSE #F

     KILL "TEMP.txt"

     IF ALL - (ALL - ALLFILES) = B THEN
       CLOSE #BF
       QUESTION$ = "No bas files found in " + SEARCH$ + " that contained " + NAME$ + "!" + CHR$(13) + "Would you like to search after another name?"
       CONFIRM QUESTION$; YN$
       IF YN$ = "yes" THEN
         GOTO [NAME]
       END IF
       CONFIRM "Would you like to search in another folder?"; YN$
       IF YN$ = "yes" THEN
         GOTO [START]
        ELSE
         END
       END IF
     END IF

     PRINT #BF.B, "RELOAD"

     PRINT #BF.B, "SELECTINDEX 1"

     PRINT #BF.B, "SETFOCUS"

     GOTO [UPDATE2]

     WAIT

[UPDATE2]

     PRINT #BF.B, "SELECTIONINDEX? INDEX"

     IF FF(INDEX) = 0 THEN
       PRINT #BF.R, "!DISABLE"
       PRINT #BF.DR, "!DISABLE"
       PRINT #BF.L, "!DISABLE"
       PRINT #BF.I, "!DISABLE"
      ELSE
       PRINT #BF.R, "!ENABLE"
       PRINT #BF.DR, "!ENABLE"
       PRINT #BF.L, "!ENABLE"
       PRINT #BF.I, "!ENABLE"
     END IF

     WAIT

[DELETE2]

     PRINT #BF.B, "SELECTIONINDEX? INDEX"

     IF FF(INDEX) = 0 THEN
       QUESTION$ = "Are you sure you want to delete " + TRIM$(BAS$(INDEX)) + " and all files and subdirectories in it?"
       CONFIRM QUESTION$; YN$
       IF YN$ = "no" THEN
         WAIT
       END IF
       CALL DELETE, PATH$(INDEX) + "\"
       IF INDEX = 1 THEN
         NOTICE "No more files or subdirectories!"
         GOTO [QUIT1]
       END IF
      ELSE
       QUESTION$ = "Are you sure you want to delete " + TRIM$(BAS$(INDEX)) + "?"
       CONFIRM QUESTION$; YN$
       IF YN$ = "no" THEN
         WAIT
       END IF
       KILL PATH$(INDEX)
     END IF

     GOTO [FILES]

[NEW2]

     PRINT #BF.B, "SELECTIONINDEX? INDEX"

     NEWFOLDER$ = "New folder"

     PROMPT "Name of the folder:"; NEWFOLDER$

     IF NEWFOLDER$ = "" THEN
       WAIT
     END IF

     IF INSTR(NEWFOLDER$, "\") <> 0 THEN
       PATH$ = NEWFOLDER$
      ELSE
       IF BAS(INDEX) = 0 THEN
         PATH$ = PATH$(INDEX) + "\" + NEWFOLDER$
        ELSE
         PATH$ = LEFT$(PATH$(INDEX), LAST(PATH$(INDEX), "\"))
       END IF
     END IF

     IF MKDIR(PATH$) <> 0 THEN
       NOTICE NEWFOLDER$; " already exist!"
       WAIT
     END IF

     GOTO [FILES]

[RENAME]

     PRINT #BF.B, "SELECTIONINDEX? INDEX"

     QUESTION$ = "New name to " + TRIM$(BAS$(INDEX)) + ":"

     RENAME$ = TRIM$(BAS$(INDEX))

     PROMPT QUESTION$; RENAME$

     IF RENAME$ = "" OR RENAME$ = TRIM$(BAS$(INDEX)) THEN
       WAIT
     END IF

     IF INSTR(RENAME$, "\") = 0 THEN
       RENAME$ = LEFT$(PATH$(INDEX), LAST(PATH$(INDEX), "\")) + RENAME$
     END IF

     IF UPPER$(RIGHT$(RENAME$, 4)) <> ".BAS" THEN
       RENAME$ = RENAME$ + ".bas"
     END IF

     ON ERROR GOTO [ERROR]

     NAME PATH$(INDEX) AS RENAME$

     GOTO [FILES]

[ERROR]

     QUESTION$ = RENAME$ + " already exist!" + CHR$(13) + "Do you want to replace it?"

     CONFIRM QUESTION$; YN$

     IF YN$ = "no" THEN
       WAIT
     END IF

     KILL RENAME$

     NAME PATH$(INDEX) AS RENAME$

     GOTO [FILES]

[REMARKS]

     PRINT #BF.B, "SELECTIONINDEX? INDEX"

     REMARKS$ = ""

     OPEN PATH$(INDEX) FOR INPUT AS #F

     WHILE EOF(#F) = 0
       LINE INPUT #F, LINE$
       LINE$ = TRIM$(LINE$)
       IF LEFT$(LINE$, 1) = "'" THEN
         REMARKS$ = REMARKS$ + RIGHT$(LINE$, LEN(LINE$) - 1) + CHR$(13)
       END IF
       IF LEFT$(LINE$, 4) = "REM " THEN
         REMARKS$ = REMARKS$ + RIGHT$(LINE$, LEN(LINE$) - 4) + CHR$(13)
       END IF
     WEND

     REMARKS$ = LEFT$(REMARKS$, LEN(REMARKS$) - 1)

     CLOSE #F

     IF REMARKS$ = "" THEN
       NOTICE "No remarks in "; TRIM$(BAS$(INDEX)); "!"
      ELSE
       CALL TEXT "Remarks in " + TRIM$(BAS$(INDEX)), REMARKS$
     END IF

     WAIT

[LOAD]

     PRINT #BF.B, "SELECTIONINDEX? INDEX"

     OPEN PATH$(INDEX) FOR INPUT AS #F

     TEXT$ = INPUT$(#F, LOF(#F))

     CLOSE #F

     CALL TEXT TRIM$(BAS$(INDEX)), TEXT$

     WAIT

[INFO]

     PRINT #BF.B, "SELECTIONINDEX? INDEX"

     FILES LEFT$(PATH$(INDEX), LAST(PATH$(INDEX), "\")), BAS$(INDEX), INFO$()

     SELECT CASE INFO$(1, 3)
       CASE "ra"
         ATTRIBUTES$ = "Read-only"
       CASE "ha"
         ATTRIBUTES$ = "Hidden"
       CASE "rha"
         ATTRIBUTES$ = "Read-only and hidden"
       CASE "a"
         ATTRIBUTES$ = "Normal"
     END SELECT

     NOTICE "- Notice -"; CHR$(13); "Name: "; TRIM$(BAS$(INDEX)); CHR$(13); "Size: "; INFO$(1, 1); " byte"; CHR$(13); "Last modified: "; INFO$(1, 2); CHR$(13); "Attributes: "; ATTRIBUTES$

     WAIT

[QUIT2]

     CLOSE #T

     WAIT

[QUIT1]

     CLOSE #BF

     END

     SUB TEXT TITLE$, TEXT$
       TEXTEDITOR #T.T, 25, 25, 372, 285
       OPEN TITLE$ FOR DIALOG_MODAL AS #T
       PRINT #T, "TRAPCLOSE [QUIT2]"
       PRINT #T.T, TEXT$
     END SUB

     FUNCTION LAST(IN$, SEARCH$)
       WHERE = INSTR(IN$, SEARCH$)
       WHILE WHERE > 0
         LAST = WHERE
         WHERE = INSTR(IN$, SEARCH$, LAST + 1)
       WEND
     END FUNCTION

     SUB FINDALL SEARCH$, DOWN
       IF DOWN = LEVELS THEN
        EXIT SUB
       END IF
       SPACE$ = SPACE$(DOWN * 2 + 2)
       FILES SEARCH$, "*.bas", INFO$()
       QTYFI = VAL(INFO$(0, 0))
       QTYFO = VAL(INFO$(0, 1))
       ALL = ALL + QTYFI + QTYFO
       ALLFILES = ALLFILES + QTYFI
       FOR A = 1 TO QTYFI
         PRINT #F, "FI "; SPACE$; INFO$(A, 0); "|"; INFO$(0, 2); INFO$(0, 3); INFO$(A, 0)
       NEXT A
       FOR A = QTYFI + 1 TO QTYFI + QTYFO
         PRINT #F, "FO "; SPACE$; INFO$(A, 1); "|"; INFO$(0, 2); INFO$(0, 3); INFO$(A, 1)
         CALL FINDALL SEARCH$ + INFO$(A, 1) + "\", DOWN + 1
       NEXT A
       FILES LEFT$(SEARCH$, LAST(LEFT$(SEARCH$, LEN(SEARCH$) - 1), "\")), "*.bas", INFO$()
     END SUB

     SUB DELETE SEARCH$
       FILES SEARCH$, "*.*", INFO$()
       QTYFI = VAL(INFO$(0, 0))
       QTYFO = VAL(INFO$(0, 1))
       FOR A = 1 TO QTYFI
         KILL INFO$(0, 2) + INFO$(0, 3) + INFO$(A, 0)
       NEXT A
       FOR A = QTYFI + 1 TO QTYFI + QTYFO
         CALL DELETE SEARCH$ + INFO$(A, 1) + "\"
       NEXT A
       A = RMDIR(LEFT$(SEARCH$, LEN(SEARCH$) - 1))
       FILES LEFT$(SEARCH$, LAST(LEFT$(SEARCH$, LEN(SEARCH$) - 1), "\")), "*.*", INFO$()
     END SUB

Post Reply