'New Release of Version v.1.2.3-W March 31 2021 W = Windows 10 L = Linux\WINE
'#####################################################################
' Visit the Just Basic forums @
https://justbasiccom.proboards.com/ for more
' information on Just Basic or this program and many more, and learn
' more about programming with the 'easy to learn' Just Basic v2.0 language.
'#####################################################################
' Title$ = "Project Organizer v.1.2.3-W for Just Basic v2.0"
'Author xxgeek - a member of the Just Basic Forums
'##################################################################
' PP$ = "Purpose = To manage the projects created with Just Basic v2.0"
' Currently = It creates a directory named Just Basic Projects by default(user can change)
' in a directory of the users choice to store each project. Then it creates a directory in the
' Projects dir each time it is RUN using the name of the BAS file selected by the user
' selected (minus the .bas). It then gathers the necessary .DLL and .SLL, files and the
' jbrun2.exe runtime file, copies them to the new project dir and renames jbrun2.exe to the
' name of the .BAS file (minus the .bas) It also creates the TKN file in the new project folder.
' Allows user to add Folders to each project - bmp, media, apps or users choice name and
' Allows user to add files to each of these Folders. Allows user to add files to the root of the New project Folder.
' Allows user to remove the Source Code (.bas) from the new Project Dir.
' User can Run the new project, browse the project folder or the Just Basic Projects Folder.
' Allows user to open iexpress.exe to make self extracting exe installer
' Keeps memory of a log of User choice of Just Basic Projects Folder Path PO.ini' while also
'allowing user to change it. Thank you to all the members of the Just Basic Forums for
' your generosity and insightful helpful posts that made this possible. Special Mentions go
'to [tsh73] for getting me started with making the TKN , [B+], [Rod], [cundo], [bluatigro],
' [Enzo],[xcoder],[honky],[ntech] and some I may have forgotten, for their solicited and
' unsolicited posts on the forums that helped with learning the JB code syntax and structure,
' and of course Carl Gundel for giving away free of charge such a great program as Just Basic v2.0.
' Thank You Carl.
' Dream Plans = a whole slew of tools, abilities like downloading files (freeware etc). Using
' Windows to provide apps at our finger tips, like MSpaint, Notepad, Run, 3D Builder. Using
' Windows Registry to do things like change Windows settings on the fly, create shortcuts,
' change screen resolution etc etc etc), Also, I have seen code on these forums like a Sprite Maker, a Search Engine for the
' help files, a Code generator etc, etc that could be added.
'#########################################################
[restart]
titlebar "Project Organizer v.1.2.3-W for Just Basic v2.0"
'if user DestPath$ is logged already, use it
if fileExists(DefaultDir$, "PO.ini") then gosub [LogCheck]
if projects$ <> "" and DestPath$ <> "" then [checkjbpath]
if projects$ <> "" and DestPath$ = "" then [start] else a = a + 1
if projects$ = "" and DestPath$ = "" then a = a + 1
'projects$ = Default Just Basic Projects Folder (User Can Change Name When P.O. is Run First Time or if \ when user changes \ edits it)
projects$ = "Just Basic Projects" ' Default Name if user wants to use it
prompt "Name Your Just Basic Projects Folder" + chr$(13) + "Default is Just Basic Projects";projects$
if projects$ = "" then notice "No Name Given P.O. Closing" : end
[start]
res=fileExists(DefaultDir$,"PO.ini")
if res then [GetDestPath]
'PO.ini can be found in the Same Folder Project Organizer is Started From After First Run
'check for PO.ini file
open "PO.ini" for output as #log
if projects$ <> "" then #log projects$
if DestPath$ <> "" then #log DestPath$
close #log
if DestPath$ = "" then [GetDestPath] else a = a + 1
'Copy Projects Folder Path from PO.ini to become DestPath$ (Projects Folder)
ini$ = "PO.ini"
open ini$ for output as #logDestPath
if projects$ <> "" then #logDestPath$, projects$
if DestPath$ <> "" then #logDestPath, DestPath$
close #logDestPath
if DestPath$ = "" then a = a + 1 else [checkjbpath]
'ask user for choice of Projects Folder Location using FolderDialog window
[GetDestPath]
res = fileExists(DefaultDir$,"PO.ini")
if res then open "PO.ini" for input as #ini
while eof(#ini) = 0
x = x + 1
line input #ini, logged$(x)
log$ = logged$(x)
if left$(log$,2) = ":" then DestPath$ = log$ else projects$ = log$
wend
close #ini
if DestPath$ <> "" then [checkjbpath]
DestPath$ = FolderDialog$("Select Drive or Folder for JB Projects Folder)")
if right$(DestPath$, 1) = "" then DestPath$ = left$(DestPath$, len(DestPath$) - 1)
If DestPath$ = "" then notice "No Path Given = No Path Made (closing P.O.)" : end
'log the Chosen Path for JB Projects Folder
gosub [logDestPath]
a = a + 1 'I love adding 1 to a
[checkjbpath]
'check Just Basic v2.0 Default Install Dir for existence
JBpath$ = "c:\Program Files (x86)\Just Basic v2.0"
res=pathExists(JBpath$)
'if Just Basic v2.0 is NOT installed to it's Default Install Dir, get Path from User
if res then [go] else notice " Just Basic v2.0 was not installed to the default install folder."+chr$(13)+"Hit [ok], then Select the Folder Just Basic v2.0 is Installed"
JBpath$ = FolderDialog$("Select the Folder Where You Installed Just Basic v2.0")
if JBpath$ = "" then notice "No path given - closing Project Organizer" : end
'remove traling \ from Path given from FolderDialog function
'if right$(JBpath$, 1) = "" then JBpath$ = left$(JBpath$, len(JBpath$) - 1)
'check existence and JBPath$
res=pathExists(JBpath$)
if res then a = a + 1 else notice " Just Basic v2.0 was not was not found in ";JBpath$;" Restart JB Project Organizer - Try Again":end
[go]
JBexe$ = "jbasic.exe"
JBruntime$ = "jbrun2.exe"
DllList$="vbas31w.sll vgui31w.sll voflr31w.sll vthk31w.dll vtk1631w.dll vtk3231w.dll vvm31w.dll vvmt31w.dll"
'Checking all paths and file locations for existence (dll's, sll's, jbasic.exe, and jbrun2.exe)
res=fileExists(JBpath$,JBexe$)
if res then a = a + 1 else notice JBexe$;" Does not exist in ";JBpath$;" Closing P.O." : end
res=fileExists(JBpath$,JBruntime$)
if res then a = a + 1 else notice JBrun$;" Does not exist in ";JBpath$;" Closing P.O." : end
res=fileExists(JBpath$,"vbas31w.sll")
if res then a = a + 1 else notice " vbas31w.sll Does not exist in ";JBpath$;" Closing P.O." : end
res=fileExists(JBpath$,"vgui31w.sll")
if res then a = a + 1 else notice " vgui31w.sll Does not exist in ";JBpath$;" Closing P.O." : end
res=fileExists(JBpath$,"voflr31w.sll")
if res then a = a + 1 else notice " voflr31w.sll Does not exist in ";JBpath$;" Closing P.O." : end
res=fileExists(JBpath$,"vthk31w.dll")
if res then a = a + 1 else notice " vthk31w.dll Does not exist in ";JBpath$;" Closing P.O." : end
res=fileExists(JBpath$,"vtk1631w.dll")
if res then a = a + 1 else notice " vtk1631w.dll Does not exist in ";JBpath$;" Closing P.O." : end
res=fileExists(JBpath$,"vtk3231w.dll")
if res then a = a + 1 else notice " vtk3231w.dll Does not exist in ";JBpath$;" Closing P.O." : end
res=fileExists(JBpath$,"vvm31w.dll")
if res then a = a + 1 else notice " vvm31w.dll Does not exist in ";JBpath$;" Closing P.O." : end
res=fileExists(JBpath$,"vvmt31w.dll")
if res then a = a + 1 else notice " vvmt31w.dll Does not exist in ";JBpath$;" P.O. Closing":end
' setup a Window for User to Select a .bas File to Make a Project with
nomainwin
WindowWidth = 600
WindowHeight = 320
UpperLeftX=INT((DisplayWidth-WindowWidth)/2)
UpperLeftY=INT((DisplayHeight-WindowHeight)/2)
BackgroundColor$ = "lightgray"
ForegroundColor$ = "black"
'add some text ,some buttons, and a menu to the Window
statictext #main.header, "Project Organizer v.1.2.3-W for Just Basic v2.0", 130, 20, 590, 35
statictext #main.1, "Select a .bas file from your Just Basic v2.0 source collection", 10, 50, 590, 25
statictext #main.2, "Provide a Path to a Folder or Drive to put your Projects Folder", 10, 70, 590, 25
statictext #main.3, "Project Organizer moves DLL's \ SLL's \ jbrun2.exe to the New Project Folder", 10, 105, 590, 25
statictext #main.4, "Project Organizer renames the jbrun2.exe to Selected .bas file (removes.bas)", 10, 120, 590, 25
statictext #main.5, "Project Organizer makes the TKN file in the New Project folder ", 10, 135, 590, 25
statictext #main.info, "Select a working Just Basic Source Code File (.bas)", 115, 175, 590, 25
statictext #main.jbforums, "Visit the Just Basic Forums @
https://justbasiccom.proboards.com/", 125, 260, 590, 20
button #main.default, "Select File", [defaultClick],UL 170, 205, 135, 35
button #main.cancel, "Cancel", [cancelClick],UL 320, 205, 135, 35
menu #main, "Options", "Make TKN File ONLY", [tknonly], "Default Path to Just Basic Projects (You Type Path)", [editini], "Default Path to Just Basic Projects (Use FolderDialog))", [fdiaginiedit], "Exit Project Organizer", [quit.main]
menu #main, "Tools", "Check ANY .bas File for # of Lines", [lines], "Change Default Folder for Projects (You type the path)", [editini], "Default Path to Just Basic Projects (Use FolderDialog)", [fdiaginiedit], "Exit Project Organizer", [quit.main]
menu #main, "Help", "Help", [help], "About", [about]
'open the Window, and set some Fonts for each statictext, and buttons
open "Project Organizer v.1.2.3-W for Just Basic v2.0" for window_nf as #main
#main, "trapclose [quit.main]"
#main, "font Arial 10 bold"
#main.header, "!font Arial 10 bold"
#main.1, "!font Arial 10 bold"
#main.2, "!font Arial 10 bold"
#main.3, "!font Arial 10 bold"
#main.4, "!font Arial 10 bold"
#main.5, "!font Arial 10 bold"
#main.info, "!font Arial 10 bold"
#main.jbforums "!font Arial 8 bold"
#main.cancel, "!font Arial 10 bold"
#main.default, "!font Arial 10 bold"
#main.default, "!setfocus"
wait
' Use the filedialog function to allow user to select a source file (.bas)
[defaultClick]
filedialog "Open \ Select a Just Basic Source File (.bas) ", DefaultDir$; "\*.bas", fname$
if fname$ = "" then notice "No file selected, P.O. will now close" : close #main : end
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)
' fname$ = Full Path of User Selected .bas file (including the filename.bas)
' fname0$ = Name of the Selected .bas File Only - eg ; filename.bas
' fnamenobas$ = Name of the Selected .bas File (without the .bas) - eg: filename
[begin]
'change text of main dialog window as the show begins
#main.header, "Creating Dirs, Copying Files to Project Dir"
' define DestPathU$ as the JB Projects Path Plus then Path of the Current Project Name
DestPathU$ = DestPath$;"";projects$
'define Destpath1$ as JB Projects\Current Project Folder
DestPath1$=DestPathU$;"";fnamenobas$
'Make Folders for Just Basic Projects and Current ProjectName
res = mkdir(DestPathU$)
res = mkdir( DestPath1$)
'make sure Folders were actuaally created
res=pathExists(DestPathU$)
if res then a = a + 1 else notice "Just Basic Projects Folder was NOT Created in ";DestPath$:close #main : end
res=pathExists(DestPath1$)
if res then a = a + 1 else notice "New Folder";fnamenobas$;" was NOT Created in ";DestPath1$:close #main : end
if fileExists(DestPath1$, fname0$) then kill DestPath1$;"";fname0$
'copy the project .bas file to this projects dir
open fname$ for input as #fname
open DestPath1$;"";fname0$ for output as #1
print #1, input$(#fname, lof(#fname));
close #fname
close #1
'check if the current project .bas file was copied to new dir
res=fileExists(DestPath1$,fname0$)
if res then a = a + 1 else notice fname0$; " Was not copied to ";DestPath1$;" P.O. will now close" : close #main : end
'################################################################################
'Create the TKN file. A good time to cross your fingers

'Getting to this pont cost me a new wig & 2 bottles of Rogain

RUN JBpath$;"";JBexe$;" -T -A ";DestPath1$;"";fname0$
'loop until TKN File is saved, and exists in the new project Folder
do
res = fileExists(DestPath1$,fnamenobas$;".tkn")
if res then exit do
scan
loop until res
'################################################################################
if fileExists(DestPath1$, JBruntime$) then kill DestPath1$;""; JBruntime$
'copy jbrun2.exe to Current Project Folder
open JBpath$;"";JBruntime$ for input as #file
open DestPath1$;"";JBruntime$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
'rename jbrun2.exe to name of User Selected .bas File - .bas +.exe
if fileExists(DestPath1$, fnamenobas$ + ".exe") then kill DestPath1$;"";fnamenobas$ + ".exe"
'Just Basic can't create\rename a file that exists, so if it does already exist - kill it (delete it)
name DestPath1$;"";JBruntime$ as DestPath1$;"";fnamenobas$ + ".exe"
'Copy the needed DLL and SLL files from Just Basic dir to New Project Dir
w$ = ""
i = 0
while 1
i = i + 1
w$=word$(DllList$,i)
if w$="" then exit while
from$=JBpath$;"";w$
to$=DestPath1$;"";w$
if fileExists(DestPath1$,w$) then kill 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
'verify dll's sll's and 'jbrun2.exe' were copied to current project folder, and jbrun2.exe renamed
if res then a = a + 1 else notice " jbrun2.exe Does not exist on the given path -> ";JBpath$;"";JBruntime$;" J.B.P.O. will now close":end
res=fileExists(DestPath1$,"vbas31w.sll")
if res then a = a + 1 else notice " vbas31w.sll Was not created in --> ";DestPath1$;" J.B.P.O. will now close":end
res=fileExists(DestPath1$,"vgui31w.sll")
if res then a = a + 1 else notice " vgui31w.sll Was not created in --> ";DestPath1$;" J.B.P.O. will now close":end
res=fileExists(DestPath1$,"voflr31w.sll")
if res then a = a + 1 else notice " voflr31w.sll Was not created in --> ";DestPath1$;" J.B.P.O. will now close":end
res=fileExists(DestPath1$,"vthk31w.dll")
if res then a = a + 1 else notice " vthk31w.dll Was not created in --> ";DestPath1$;" J.B.P.O. will now close":end
res=fileExists(DestPath1$,"vtk1631w.dll")
if res then a = a + 1 else notice " vtk1631w.dll Was not created in --> ";DestPath1$;" J.B.P.O. will now close":end
res=fileExists(DestPath1$,"vtk3231w.dll")
if res then a = a + 1 else notice " vtk3231w.dll Was not created in --> ";DestPath1$;" J.B.P.O. will now close":end
res=fileExists(DestPath1$,"vvm31w.dll")
if res then a = a + 1 else notice " vvm31w.dll Was not created in --> ";DestPath1$;" J.B.P.O. will now close":end
res=fileExists(DestPath1$,"vvmt31w.dll")
if res then a = a + 1 else notice " vvmt31w.dll Was not created in --> ";DestPath1$;" J.B.P.O. will now close":end
'check new Project exe and tkn files for existence in Current Project Folder (quit P.O. if not)
res=fileExists(DestPath1$,fnamenobas$;".exe")
if res then a=a+1 else notice "jbrun2.exe not copied or renamed - EXITING ": close #main : end
'##################################################################
'Close the main Window - Make Window with Menus to add folders\files\buttons for Run Project, Make exe, Browse,
'Remove source File From Current Project Folder
[include]
close #main
WindowWidth = 600
WindowHeight = 320
UpperLeftX=INT((DisplayWidth-WindowWidth)/2)
UpperLeftY=INT((DisplayHeight-WindowHeight)/2)
BackgroundColor$ = "lightgray"
ForegroundColor$ = "black"
statictext #include.header, "See Menus Above to Add Files or Folders", 10, 35, 350, 35
statictext #include.jbforums, "Visit
https://justbasiccom.proboards.com/", 145, 240, 450, 35
' Add text and buttons
button #include.remsource, "Remove Source File", [remsource],UL 185, 160, 180, 35
button #include.back, "Back", [back],UL 10, 290, 90, 35
button #include.browseN, "Browse this Project Folder", [browseN],UL 30, 100, 230, 35
button #include.browseP, " Browse Just Basic Projects Folder", [browseP],UL 280, 100, 280, 35
button #include.makeinst, "Make Installer (Iexpress)", [makeinst],UL 385, 160, 200, 35
button #include.run, "Run Your Project", [run],UL 15, 160, 150, 35
menu #include, "Options", "Run Current Project", [run], "Make Installer (iexpress)", [makeinst], "Remove Source File (.bas)", [remsource], "Open any .bas File, check for # of lines", [lines], "Back to Main Menu", [back], "Exit Add Files/Folders Restart Program", [exit]
menu #include, "Create Folders and Add Files", "Create bmp Folder Add bmp Files (.bmp)", [bmpf], "Create Media Folder Add Media Files (.wav)", [medf], "Create Apps Folder Add App Files (*.*)", [appf], "Name a Folder Add Files to it (*.*)", [userf], "Add Files to the Root of Project Folder (*.*)", [rootf]
menu #include, "Browse", "New Project Folder", [browseN], "Your Chosen BAS File Folder", [orig], "Just Basic Projects Dir", [browseP]
menu #include, "Defaults", "Change JB Projects Default Folder (You Type The Path)", [editini], "Change Just Basic Projects Default Folder (Use FolderDialog)", [fdiaginiedit], "Kick Windows in Head Relieve Stress

", [kickhard]
menu #include, "Help", "Help", [help], "About", [about]
'Set Font's for this window, statictext, and buttons
open "Options For This New Project" for window_nf as #include
#include, "trapclose [quit.include]"
#include, "font Arial 10 bold"
#include.header, "!font Arial 10 bold"
#include.remsource, "!font Arial 10 bold"
#include.back, "!font Arial 10 bold"
#include.browseN, "!font Arial 10 bold"
#include.browseP, "!font Arial 10 bold"
#include.makeinst, "!font Arial 10 bold"
#include.run, "!font Arial 10 bold"
wait
'make the TKN File ONLY was Selected
[tknonly]
'When Creating a TKN File it is Created in Same Folder as the .bas File Selected.
notice "creating TKN File ONLY"+chr$(13)+ "The TKN File will be created in the Same Dir as Selected .bas File"+chr$(13)+fname$+chr$(13)+" Just hit [ENTER] or Click [OK] when the 'Save To' Window Appears. If the Default Location is Not Selected, this Organizer Cannot track the TKN File's Location. You're on your own."
filedialog "Open \ Select JB Source File ", DefaultDir$; "\*.bas", fname$
if fname$ = "" then notice "No file selected, P.O. will now close" : close #main : end
RUN JBpath$;"";JBexe$;" -T -A ";fname$
TKNPath$ = GetPath$(fname$)
TKNname$ = GetFilename$(fname$)
TKNname$ = left$(TKNname$,len(TKNname$)-3)
TKNname$ = TKNname$;".tkn"
message$ = chr$(13);chr$(13);" If you saved the TKN File to the Location the FileDialog 'Save' window defaulted to, the TKN File will be there, else if you saved it elsewhere, Program Organizer cannot know it's location. The Act of making the TKN File rests in the hands of jbasic.exe, and this Organizer is not informed of what jbasic.exe or the Users Choice of Location to Save the TKN"
message$ = GetMessage$(message$)
res = fileExists(TKNPath$,TKNname$)
if res then notice "The TKN File WAS Created in ";TKNPath$ : wait
if res <> 0 then notice "The TKN File was NOT Created in the Default Location, but May have been Created Where the USER Saved it."
wait
'just a joke to relieve some stress
[kickhard]
notice "OUCH!! I DESERVE MANY MORE - You OWE me!! "
wait
'Report the number of lines in a bas File Selected in filedialog
[lines]
dim line$(50000)
filedialog "Open a Source File (.bas) ", DefaultDir$; "\*.bas", fname$
if fname$ = "" then notice "No file selected, P.O. will now close" : close #main : end
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)
[linescurrent]
file$ = fname$
open file$ for input as #1
while eof(#1) = 0
line input #1, line$(x)
spaces$ = line$(x)
if spaces$ = "" then y = y + 1
x = x +1
wend
close #1
message$ = chr$(13);chr$(13);" ";fname0$;chr$(13);chr$(13);" ";x-y;" lines of code";chr$(13);" ";y;" lines of spaces ";chr$(13);" ";x;" lines in total"
message$ = GetMessage$(message$)
wait
'Make a bmp Folder in the Current Project Folder Automatically when 'add bmp file' is pressed
' then Ask For .bmp File to Add to it. Same Goes for media, apps folders being Created in Projects Folder
[bmpf]
bmp$ = "bmp"
filedialog "Open a bmp File - (.bmp)", DefaultDir$;"";"*.bmp", FullPathbmpFile$
if FullPathbmpFile$ = "" then notice "No Folder Chosen = No Folder or File Copied" : wait
bmpFile$ = FullPathbmpFile$
bmpFile$ = GetFilename$(bmpFile$)
if fileExists(DestPath1$;"";bmp$,bmpFile$) then confirm "!!! WARNING !!! !!! WARNING !!! !!! WARNING !!!"+chr$(13)+"File already exists"+chr$(13)+"Do you want to OverWrite this File?";WellDoYouPunk$
if WellDoYouPunk$ <> "yes" then wait
open FullPathbmpFile$ for input as #file
res = mkdir( DestPath1$;"";bmp$)
open DestPath1$;"";bmp$;"";bmpFile$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
res=fileExists(DestPath1$;"";bmp$,bmpFile$)
if res then notice bmpFile$;" Was copied to ";DestPath1$;"";bmp$ else notice bmpFile$;" Was not copied to ";DestPath$;"";bmp$
wait
'Make media Folder Automatically, add media File (.wav) using filedialog function
[medf]
media$ = "media"
filedialog "Open a media File - (.wav)", DefaultDir$;"";"*.wav", FullPathmediaFile$
'If user uses Cancel Button in filedialog Window bypass File Copy, inform user no file created
if FullPathmediaFile$ = "" then notice "No Folder Chosen = No Folder or File Copied" : goto [nomedia]
mediaFile$ = FullPathmediaFile$
mediaFile$ = GetFilename$(mediaFile$)
if fileExists(DestPath1$;"";media$, mediaFile$) then confirm "!!! WARNING !!! !!! WARNING !!! !!! WARNING !!!"+chr$(13)+"File already exists"+chr$(13)+"Do you want to OverWrite this File?";WellDoYouPunk$
if WellDoYouPunk$ <> "yes" then wait
open FullPathmediaFile$ for input as #file
res = mkdir( DestPath1$;"";media$)
open DestPath1$;"";media$;"";mediaFile$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
res=fileExists(DestPath1$;"";media$,mediaFile$)
if res then notice mediaFile$;" Was copied to ";DestPath1$;"";media$ else notice mediaFile$;" Was not copied to ";DestPath1$;"";media$
wait
'Make apps Folder Automatically, add File (.exe etc) using filedialog function
[appf]
apps$ = "apps"
filedialog "Open an Executable File (.exe 'etc')", DefaultDir$;"";"*.*", FullPathappFile$
if FullPathappFile$ = "" then notice "No Folder Chosen = No Folder or File Copied" : wait
appFile$ = FullPathappFile$
appFile$ = GetFilename$(FullPathappFile$)
if fileExists(DestPath1$;"";apps$, appFile$) then confirm "!!! WARNING !!! !!! WARNING !!! !!! WARNING !!!"+chr$(13)+"File already exists"+chr$(13)+"Do you want to OverWrite this File?";WellDoYouPunk$
if WellDoYouPunk$ <> "yes" then wait
open FullPathappFile$ for input as #file
res = mkdir( DestPath1$;"";apps$)
open DestPath1$;"";apps$;"";appFile$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
res=fileExists(DestPath1$,appFile$)
if res then notice appFile$;" Was copied to ";DestPath1$;"";apps$ else notice appFile$;" Was not copied to ";DestPath1$;"";apps$
wait
'Make User Choice Foldername Automatically, Add File to it Using filedialog Function
[userf]
prompt "Give the folder a name" + chr$(13) + "Type any Name for this Folder";userDir$
if userDir$ = "" then notice "No Path Given = No Folder Created" : wait
filedialog "Add a File to Folder that was Just Created", DefaultDir$;"";"*.*", FullPathuserFile$
if FullPathuserFile$ = "" then notice "No File Chosen = No File Copied" : wait
userFile$ = FullPathuserFile$
userFile$ = GetFilename$(userFile$)
if fileExists(DestPath1$;"";userDir$, userFile$) then confirm "!!! WARNING !!! !!! WARNING !!! !!! WARNING !!!"+chr$(13)+"File already exists"+chr$(13)+"Do you want to OverWrite this File?";WellDoYouPunk$
if WellDoYouPunk$ <> "yes" then wait
open FullPathuserFile$ for input as #file
res = mkdir( DestPath1$;"";userDir$)
open DestPath1$;"";userDir$;"";userFile$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
res=fileExists(DestPath1$;"";userDir$, userFile$)
if res then notice userFile$;" was added to ";DestPath1$;"";userDir$ else notice userFile$;" Was not added to ";DestPath1$;"";userDir$
wait
'Give User Option to Add File to the root Folder of their Current Project
[rootf]
filedialog "Add Files to root of New Project Dir", "c:\*.*", FullPathrootFile$
if FullPathrootFile$ = "" then notice "No File Chosen = No File Copied" : wait
rootFile$ = FullPathrootFile$
rootFile$ = GetFilename$(rootFile$)
if fileExists(DestPath1$, rootFiile$) then confirm "!!! WARNING !!! !!! WARNING !!! !!! WARNING !!!"+chr$(13)+"File already exists"+chr$(13)+"Do you want to OverWrite this File?";WellDoYouPunk$
if WellDoYouPunk$ <> "yes" then wait
open FullPathrootFile$ for input as #file
open DestPath1$;"";rootFile$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
res=fileExists(DestPath1$,rootFile$)
if res then notice rootFile$;" Was added to ";DestPath1$ else notice rootFile$;" Was not added to ";DestPath1$
wait
'code for removing the .bas source file from the Current Project Folder
[remsource]
delFile$ = "yes"
prompt "Delete the source code file? - You Sure?" + chr$(13) + "Does not affect Original .bas file";delFile$
if delFile$ = "" then wait
res=fileExists(DestPath1$,fname0$)
if left$(delFile$, 1) = "y" or left$(delFile$, 1) = "Y" and res then kill DestPath1$;"";fname0$
res=fileExists(DestPath1$,fname0$)
if res then notice fname0$;" Has not been removed from ";DestPath1$ else notice fname0$;" Has been removed from ";DestPath1$
wait
'go back to main menu (user can select a new .bas file and Start again)
[back]
close #include
goto [start]
wait
'Start iexpress.exe (a built in Windows Install Maker = Self Extracting exe File)
[makeinst]
res=fileExists("c:\windows\system32","iexpress.exe")
if res then run "iexpress.exe" else notice "Cannot find file --> iexpress.exe in c:\windows\system32"+chr$(13)+"Known issue for users of WINE in Linux"+chr$(13)+"Check WINE Tricks for Adding IExpress(after each update)"
wait
'open Windows explorer to the Just Basic Projects Folder
[browseP]
run "explorer.exe ";DestPathU$
wait
'open Windows explorer to the Current Project Folder
[browseN]
run "explorer.exe ";DestPath1$
wait
'Run the current project
[run]
res=fileExists(DestPath1$,fnamenobas$;".exe")
if res then run DestPath1$;"";fnamenobas$;".exe" else notice fnamenobas$;" Does Not Exist in ";DestPath1$
wait
'Browse the Folder of the Selected .bas File
[orig]
run "explorer ";orig$
wait
[help]
notice "For Help - Read this BAS file (Ten Times)"
wait
[about]
notice, "About file coming in future zip version"
wait
'done with adding folders\files etc - close P.O.
[exit]
close #include
end
[cancelClick]
close #main
end
'done with adding folders\files etc
[quit.include]
close #include
end
'close main window and exit program
[quit.main]
close #main
end
'Change Just Basic Projects Path (using folderdialog window)
[fdiaginiedit]
DestPath$ = FolderDialog$("Select a Drive or Folder for JB Projects Dir - Note: Only Drives & Folders Show Below (No Files)")
if DestPath$ = "" then notice "No Path given = No Path Saved" : wait
open "PO.ini" for output as #iniedit
print #iniedit, projects$
print #iniedit, DestPath$
close #iniedit
'Remove trailing \ from Path returned from FolderDialog Function
if right$(DestPath$, 1) = "" then DestPath$ = left$(DestPath$, len(DestPath$) - 1)
wait
'Change Just Basic Projects Path (typed into prompt Window by user)
[editini]
prompt "Change JB Projects Default Folder Path" + chr$(13) + "Type a New Default Path" ; iniedit$
if iniedit$ = "" then notice "No Path given = No Path Saved" : wait
if right$(DestPath$, 1) = "" then DestPath$ = left$(DestPath$, len(DestPath$) - 1)
open "PO.ini" for output as #ini
#ini, projects$
#ini, DestPath$
close #ini
wait
'make a log(PO.ini) of users choice of Just Basic Projects path in same folder
'as this program is running from or started from.
[logDestPath]
If DestPath$ = "" then notice "No Path Given = No Path Made" : return
ini$ = "PO.ini"
open ini$ for output as #log
if projects$ <> "" then #log, projects$
if DestPath$ <> "" then #log, DestPath$
close #log
return
'check if PO.ini exists, if it does, and it holds a Path then use it's contents
' as the User Choice Path (DestPath$) and projects Dir Name (projects$) upon 'return'
[LogCheck]
res=fileExists(DefaultDir$,"PO.ini")
if res then a = a + 1 else open "PO.ini" for output as #ini : #ini, projects$ : #ini, DestPath$ : close #ini
open "PO.ini" for input as #ini
while eof(#ini) = 0
line input #ini, logged$
x = x + 1
if logged$ = "" then close #ini : return
if left$(logged$, 2) = ":" then DestPath$ = log$
if x = 1 then projects$ = logged$
if x = 2 then DestPath$ = logged$
'remove trailing "" from path given by folderdialog
if right$(DestPath$, 1) = "" then DestPath$ = left$(log$, len(log$) - 1)
wend
close #ini
return
'subroutine for making pauses
sub pause mil
t=time$("ms")+mil
while time$("ms")<t
scan
wend
end sub
'function for checking file existence
function fileExists(path$, filename$)
dim info$(0, 0)
files path$, filename$, info$()
fileExists = val(info$(0, 0)) 'non zero is true
end function
'function for checking folder existence
function pathExists(path$)
pathExists = (mkdir(path$)=183)
end function
'functions for making the folder dialog window
function FolderDialog$(caption$)
WindowWidth = 600
WindowHeight = 370
UpperLeftX=INT((DisplayWidth-WindowWidth)/2)
UpperLeftY=INT((DisplayHeight-WindowHeight)/2)
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, 130
button #folderdlg.default, "Ok", [FolderDlgOk], UL, 190, 293, 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, 225, 510, 30
statictext #folderdlg.path, "Selected Drive or Folder Path Appears Here", 130, 258, 400, 20
open caption$ for dialog_modal as #folderdlg
#folderdlg, "trapclose [FolderDlgCancel]"
#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$"
If right$(FolderDialog$,1) = "" then FolderDialog$ = left$(FolderDialog$, len(FolderDialog$) - 1)
[FolderDlgCancel]
close #folderdlg
end function
'function to separate folderpath from filename.ext - returns filename.ext
function GetFilename$(fileName$)
i = len(fileName$)
while mid$(fileName$, i, 1) <> "" and mid$(fileName$, i, 1) <> ""
i = i-1
wend
GetFilename$ = mid$(fileName$, i+1)
end function
'function to separate path from filename, returns path
function GetPath$(fileName$)
i = len(fileName$)
while mid$(fileName$, i, 1) <> "" and mid$(fileName$, i, 1) <> ""
i = i-1
wend
GetPath$ = left$(fileName$, i)
end function
'function to make messages
function GetMessage$(message$)
WindowWidth = 350 : WindowHeight = 200
UpperLeftX=INT((DisplayWidth-WindowWidth)/2)
UpperLeftY=INT((DisplayHeight-WindowHeight)/2)
BackgroundColor$ = "lightgray" : ForegroundColor$ = "black"
statictext #textmessage.text, "", 0, 0, 350, 350
button #textmessage.button, "OK", [quit], UL, 140, 110, 55, 35
open "Information Message - Tips for User" for window as #textmessage
#textmessage.button, "!setfocus"
print #textmessage, "trapclose [close]"
#textmessage, "font Arial bold 8"
#textmessage.text, message$
#textmessage.button, "!font Arial bold 10"
wait
[close]
close #textmessage : exit function
scan
wait
[quit]
scan
close #textmessage : exit function
end function
'th th th th th that's all folks

- for now!