A JustBasic File Explorer

General Computer Utilities
NTech
Posts: 23
Joined: Mon May 01, 2017 7:29 pm
Location: USA

A JustBasic File Explorer

Post by NTech » Fri May 19, 2017 4:28 pm

This is a simple visual file explorer. You can enter folders and see the folders and
files inside a folder. You cannot go back, however. Improve it if you like. Some
nice improvements would be a search function and a goback sub. But, I am working on
it...Here is the code BELOW:

Code: Select all

global noOfFoldersEntered
noOfFoldersEntered = 0
dim fileInfo$(3,3)
dim pathView$(500)
files "C:\", fileInfo$()


    dim file$(2, 2)
    dim fileView$(500)
    files "C:\", file$()

    for i = 1 to val(file$(0, 0))
        'print "File: " + file$(i, 0)
        fileView$(i) = file$(i, 0)
    next i

dim folder$(3, 3)
dim folderView$(500)
files "C:\", folder$()

    for i = 1 to val(folder$(0, 1))

        folderView$(i) = folder$(i, 1)
    next i
pathView$(0) = "C:\"
goto [view]
wait

[loop]
close #main
redim fileInfo$(3,3)
files newDrive$, fileInfo$()

redim file$(2, 2)
redim fileView$(500)
    files newDrive$, file$()

    for i = 1 to val(file$(0, 0))

        fileView$(i) = file$(i, 0)
    next i

redim folder$(3, 3)
redim folderView$(500)
files newDrive$, folder$()

    for i = 1 to val(folder$(0, 1))

        folderView$(i) = folder$(i, 1)
    next i

pathView$(noOfFoldersEntered) = newDrive$
goto [view]
wait

[view]

    nomainwin

    WindowWidth = 608
    WindowHeight = 515
    UpperLeftX = int((DisplayWidth-WindowWidth)/2)
    UpperLeftY = int((DisplayHeight-WindowHeight)/2)

    menu #main, "Menu", "&About", [about], | ,"Exit", [quit]
    listbox #main.visited, pathView$(), [tellPathView], 6, 6, 88, 465
    listbox #main.files, folderView$(), [folderEnter], 102, 31, 480, 215
    listbox #main.filez, fileView$(), [na], 102, 271, 480, 190
    statictext #main.statictext3, "Folders:", 110, 6, 64, 20
    statictext #main.statictext4, "Files:", 110, 250, 48, 20

    open "File Explorer" for window as #main
    print #main, "font ms_sans_serif 0 16"

    wait
[folderEnter]
    noOfFoldersEntered = noOfFoldersEntered + 1
    num = noOfFoldersEntered
    #main.files, "selection? Driver$"
    Driver$ = newDrive$ + "\" + Driver$
    newDrive$ = Driver$
    goto [loop]
    wait


[tellPathView]
    #main.visited, "selection? pathy$"
    notice "Location: " + pathy$
    wait


[na]
    #main.filez, "selection? fileNamert$"
    notice "File: " + fileNamert$
    wait

[about]
notice "File Explorer" + chr$(13) + "File Explorer" + chr$(13) + "Copyright 2017 N-Tech"
wait

[quit]
close #main
end
8)V1.2 Coming Up, Will Be Able To Read Files.
Last edited by stpendl on Sat May 20, 2017 10:24 pm, edited 1 time in total.
Reason: added code tags
8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8)