Post by xxgeek on Mar 7, 2021 19:45:43 GMT
Project Organizer v..009W for Windows 10 and v.009L for Linux using WINE RC1 for Just Basic v2.0
EDIT - One Caveat I should mention.
When the TKN file is being created it opens up Just Basic editor with the file you chose and closes the editor once you save the TKN file. BUT, when it opens the file in the editor it is automatically debugged on the spot, and if there are any errors the TKN file will not be created, and the Program exits. Nothing I can do about the debugging at this time, maybe never. So if you're testing this, don't test it on the sample .bas files provided by Just Basic. Test it on KNOWN working .bas files. Some of the samples are good to go, but I don't have a list. I do know that 3d_demo.bas works well, and NEWCOLOR.bas too, I used them while testing myself.
Lots of new stuff. I was up all night fixing the cmd.exe problem and refined, edited and fixed anything I saw along the way, like spelling errors or button placement etc. Tested to the point of exhaustion. (Doesn't mean it shouldn't be tested by YOU.)
1. No more cmd.exe calls it is entirely JB code now.
2. There are menus on the top of each of the windows, the #main and the #include - check them out, there are new options etc.
3.On First Run it will ask for a Path to put a Folder Named Just Basic Projects and it will save your choice of Folder to an ini file in the same Dir it is Run from named PO.ini. This file is editable or changeable from both the #main window and the #include menu.
On second Run and subsequent Run's it will ask if you want to use the same folder or you can say no, or n or anything but Y and y and it will allow you to change it.
4.Colors have changed to lightgrey background and black foreground - it looks better.
5.So far I have kept it too itself, meaning it has no files it depends on to Run. The next version, or at least at some point it WILL have files and require to be zipped. Since it has no extra file right now there is no help file, and no about page.
6. When copying Files like bmp and wav to the new project, it automatically creates the folder first as a rule, assuming you want .bmp files in the bmp dir. There is also choices to make your own Dirs, and files in the root, or any other Folder.
I found a Folderdialog somewhere a few months ago that didn't work, and I got it to work, but I don't remember where, or who wrote most of it to give them credit. If it was you, please advise. I have taken snippets from here and there as I was learning JB and you may see things you wrote, or pieces of it. I'm not a thief, so if you see something you want taken out, let me know.
Everything has been working well here for me on Windows 10.
Let me know ANY problems ASAP. And if there is more, advice, wish lists, or criticism I want to hear it.
I would say that just about every member of this forum who posts code in one way or another has helped this project, and me in my quest for knowledge. Thank You All.
Now, the Project Organizer v.009LW RC1 - For Windows 10
For Linux Users Using WINE Updated because it wasn't working March 12 2021
EDIT - One Caveat I should mention.
When the TKN file is being created it opens up Just Basic editor with the file you chose and closes the editor once you save the TKN file. BUT, when it opens the file in the editor it is automatically debugged on the spot, and if there are any errors the TKN file will not be created, and the Program exits. Nothing I can do about the debugging at this time, maybe never. So if you're testing this, don't test it on the sample .bas files provided by Just Basic. Test it on KNOWN working .bas files. Some of the samples are good to go, but I don't have a list. I do know that 3d_demo.bas works well, and NEWCOLOR.bas too, I used them while testing myself.
Lots of new stuff. I was up all night fixing the cmd.exe problem and refined, edited and fixed anything I saw along the way, like spelling errors or button placement etc. Tested to the point of exhaustion. (Doesn't mean it shouldn't be tested by YOU.)
1. No more cmd.exe calls it is entirely JB code now.
2. There are menus on the top of each of the windows, the #main and the #include - check them out, there are new options etc.
3.On First Run it will ask for a Path to put a Folder Named Just Basic Projects and it will save your choice of Folder to an ini file in the same Dir it is Run from named PO.ini. This file is editable or changeable from both the #main window and the #include menu.
On second Run and subsequent Run's it will ask if you want to use the same folder or you can say no, or n or anything but Y and y and it will allow you to change it.
4.Colors have changed to lightgrey background and black foreground - it looks better.
5.So far I have kept it too itself, meaning it has no files it depends on to Run. The next version, or at least at some point it WILL have files and require to be zipped. Since it has no extra file right now there is no help file, and no about page.
6. When copying Files like bmp and wav to the new project, it automatically creates the folder first as a rule, assuming you want .bmp files in the bmp dir. There is also choices to make your own Dirs, and files in the root, or any other Folder.
I found a Folderdialog somewhere a few months ago that didn't work, and I got it to work, but I don't remember where, or who wrote most of it to give them credit. If it was you, please advise. I have taken snippets from here and there as I was learning JB and you may see things you wrote, or pieces of it. I'm not a thief, so if you see something you want taken out, let me know.
Everything has been working well here for me on Windows 10.
Let me know ANY problems ASAP. And if there is more, advice, wish lists, or criticism I want to hear it.
I would say that just about every member of this forum who posts code in one way or another has helped this project, and me in my quest for knowledge. Thank You All.
Now, the Project Organizer v.009LW RC1 - For Windows 10
'New Release Version v.009W L = linux\wine W = Windows 10
'#####################################################################
' Visit the 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 language.
'#####################################################################
' Title$ = "Project Organizer v.009W for Just Basic v2.0"
' PP$ = "Purpose = To manage the projects created with Just Basic v2.0"
' and add features to help with whatever a user may want to do with:
' the projects they create.
' Currently = It creates a directory named Just Basic Projects 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 (minus the .bas). It then gathers the necessary .DLL and .SLL, files and the
' jbrun2.exe runtime file, copies them to the new 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),
' and a users choice of a folder name to add any files they wish.
' 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
' Allows user to Run the new project
' Allows user to browse the project folder or the just Basic Projects folder
' Allows user to open iexpress.exe to make self extracting exe installer
' Makes a log of User choice of Just Basic Projects Folder Path
' While also allowing user to change it every time run.
' 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 (sorry, I'm losing my mind) :D 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 etc etc etc. 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.
'#########################################################
titlebar "Project Organizer v.009W for Just Basic v2.0"
[start]
JBpath$ = "c:\Program Files (x86)\Just Basic v2.0"
res=pathExists(JBpath$)
if res then [go] else notice " Just Basic v2.0 was not installed to the default install folder"
JBpath$ = FolderDialog$("Select the Folder Where You Installed Just Basic v2.0")
if JBpath$ = "" then notice "No path given - closing Project Organizer"
if right$(JBpath$, 1) = "\" then JBpath$ = left$(JBpath$, len(JBpath$) - 1)
[go]
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
JBexe$ = "jbasic.exe"
JBruntime$ = "jbrun2.exe"
DllList$="vbas31w.sll vgui31w.sll voflr31w.sll vthk31w.dll vtk1631w.dll vtk3231w.dll vvm31w.dll vvmt31w.dll"
qq$=chr$(34) '(") - used later to wrap quotes around file paths.
a = 0
'Checking all paths and file locations for existence
res=pathExists(JBpath$)
if res then a = a + 1 else notice " JBpath Does not exist on the given path - > ";JBpath$;" J.B.P.O. will now close":end
res=fileExists(JBpath$,JBexe$)
if res then a = a + 1 else notice " jbasic.exe Does not exist on the given path -> ";JBpath$;" J.B.P.O. will now close":end
res=fileExists(JBpath$,JBruntime$)
if res then a = a + 1 else notice " jbrun2.exe Does not exist on the given path -> ";JBpath$;" J.B.P.O. will now close":end
res=fileExists(JBpath$,"vbas31w.sll")
if res then a = a + 1 else notice " vbas31w.sll Does not exist on the given path -> ";JBpath$;" J.B.P.O. will now close":end
res=fileExists(JBpath$,"vgui31w.sll")
if res then a = a + 1 else notice " vgui31w.sll Does not exist on the given path -> ";JBpath$;" J.B.P.O. will now close":end
res=fileExists(JBpath$,"voflr31w.sll")
if res then a = a + 1 else notice " voflr31w.sll Does not exist on the given path -> ";JBpath$;" J.B.P.O. will now close":end
res=fileExists(JBpath$,"vthk31w.dll")
if res then a = a + 1 else notice " vthk31w.dll Does not exist on the given path -> ";JBpath$;" J.B.P.O. will now close":end
res=fileExists(JBpath$,"vtk1631w.dll")
if res then a = a + 1 else notice " vtk1631w.dll Does not exist on the given path -> ";JBpath$;" J.B.P.O. will now close":end
res=fileExists(JBpath$,"vtk3231w.dll")
if res then a = a + 1 else notice " vtk3231w.dll Does not exist on the given path -> ";JBpath$;" J.B.P.O. will now close":end
res=fileExists(JBpath$,"vvm31w.dll")
if res then a = a + 1 else notice " vvm31w.dll Does not exist on the given path -> ";JBpath$;" J.B.P.O. will now close":end
res=fileExists(JBpath$,"vvmt31w.dll")
if res then a = a + 1 else notice " vvmt31w.dll Does not exist on the given path -> ";JBpath$;" J.B.P.O. will now close":end
' setup a window
nomainwin
WindowWidth = 600
WindowHeight = 320
UpperLeftX=INT((DisplayWidth-WindowWidth)/2)
UpperLeftY=INT((DisplayHeight-WindowHeight)/2)
BackgroundColor$ = "lightgray"
ForegroundColor$ = "black"
statictext #main.header, "Project Organizer v.009W for Just Basic v2.0", 130, 20, 590, 35
statictext #main.1, "Select a .bas file from your Just Basic v2.0 source collection", 90, 55, 590, 25
statictext #main.2, "Provide a Path to a Folder or Drive to put your Projects Folder", 90, 70, 590, 25
statictext #main.3, "Project Organizer moves DLL's \ SLL's \ jbrun2.exe to the New Project Folder", 90, 105, 590, 25
statictext #main.4, "Project Organizer renames the jbrun2.exe to Selected .bas file (removes.bas)", 90, 120, 590, 25
statictext #main.5, "Project Organizer makes the TKN file in the New Project folder ", 90, 135, 590, 25
statictext #main.info, "Select a working Just Basic Source Code File (.bas)", 115, 175, 590, 35
statictext #main.jbforums, "Visit the Just Basic Forums @ https://justbasiccom.proboards.com/", 125, 255, 590, 20
button #main.default, "Select File", [defaultClick],UL 170, 210, 135, 35
button #main.cancel, "Cancel", [cancelClick],UL 320, 210, 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, "Browse", "Browse Your Just Basic Projects Folder ", [browseP]
menu #main, "Help", "Help", [help], "About", [about]
open "Project Organizer v.009W for Just Basic v2.0" for window_nf as #main
#main, "trapclose [quit.main]"
#main, "font Arial 10 bold"
#main.header, "!font Arial 12 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 12 bold"
#main.jbforums "!font Arial 8 bold"
#main.cancel, "!font Arial 12 bold"
#main.default, "!font Arial 12 bold"
#main.default, "!setfocus"
wait
'select a source file
[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)
'check if PO.ini already exists
res=fileExists(DefaultDir$,"PO.ini")
YorN$ = "yes"
'if PO.ini DOESN'T exist
if res = 0 then goto [firstrun]
'if PO.ini DOES exist
if res then gosub [DestPathLog] : prompt "Use Same Projects Dir? (path below)" + chr$(13 ) + logged$ + chr$(13) + " For This Project. Y or N ?";YorN$
if left$(YorN$, 1) = "N" or left$(YorN$, 1) = "n" then goto [firstrun]
if YorN$ = "" then notice "No answer given. JBPO will now close" : close #main : end
if left$(YorN$, 1) = "Y" or left$(YorN$, 1) = "y" then DestPath$ = logged$ : goto [fixpath]
'reset YorN$ to nothing to avoid a collision between first run and future runs
YorN$ = ""
[firstrun]
DestPath$ = FolderDialog$("Select a Drive or Folder for JB Projects Dir - Note: Only Drives & Folders Show Below (No Files)")
if right$(DestPath$, 1) = "\" then DestPath$ = left$(DestPath$, len(DestPath$) - 1)
'log DestPath$ for future runs
res=fileExists(StartupDir$,"PO.ini")
if res then goto [fixpath]
gosub [logDestPath]
if DestPath$ = "" then notice "No Folder Path given, closing JB Program Organizer": goto [quit.main]
'take the trailing \ out of the path created in [logDestPath] when a drive is selected
[fixpath]
if right$(DestPath$, 1) = "\" and len(DestPath$) = 3 then DestPath$ = left$(DestPath$, 2)
goto [begin]
wait
'if user cancels
[cancelClick]
close #main
end
wait
'start making DestPath , DestPath1 folders and copying needed files
[begin]
'change text of main dialog window
#main.header, "Creating Dirs, Copying Files to Project Dir"
#main.default, "!hide"
#main.1, "!hide"
#main.2, "!hide"
#main.3, "Gettin er done >>>>"
#main.4, "!hide"
#main.5, "!hide"
#main.info, "!font Arial 12 bold"
#main.3, "!font Arial 12 bold"
' redefine DestPath
projects$ = "Just Basic Projects"
DestPath$ = DestPath$;"\";projects$
'inform user
do
z = z + 1
#main.info, "Creating Projects Folder .... . .. "
#main.3, "Gettin er done > > > >"
call pause 100
loop until z = 3
z=0
'redefine Destpath1$
DestPath1$=DestPath$;"\";fnamenobas$
'Make dir's for Just Basic Projects and Current ProjectName
res = mkdir( DestPath$)
res = mkdir( DestPath1$)
'inform user and create a pause for WindowsOS to catch up
do
z = z + 1
#main.info, "Waiting for Windows to make the Folders ... . ... . "
#main.3, "Gettin er done > > > >"
call pause 100
loop until z = 3
z=0
'Check Just Basic Projects Folder and New Project Folder were created
res=pathExists(DestPath$)
if res then a = a + 1 else notice "Just Basic Projects Folder was NOT Created":close #main : end
res=pathExists(DestPath1$)
if res then a = a + 1 else notice "Just Basic Projects Folder was NOT Created":close #main : end
'copy the project .bas file to new dir
open fname$ for input as #fname
open DestPath1$;"\";fname0$ for output as #1
print #1, input$(#fname, lof(#fname));
close #fname
close #1
'inform user and create a pause for WindowsOS to catch up
do
z = z + 1
#main.info, "Moving BAS file to New Project Dir . ... .. "
#main.3, "Gettin er done > > > >"
call pause 100
loop until z = 3
z=0
'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$;" J.B.P.O. will now close":close #main:end
'inform user and create a pause for WindowsOS to catch up
do
z = z + 1
#main.info, "Creating TKN File in New Project Dir . ... .. "
#main.3, "Gettin er done > > > >"
call pause 100
loop until z = 3
z=0
'################################################################################
'Create the TKN file. A good time to cross your fingers :D
'Getting to this pont cost me a new wig & 2 bottles of Rogain :D
RUN JBpath$;"\";JBexe$;" -T -A ";DestPath1$;"\";fname0$
'add a notice to halt program until TKN file is saved
'notice "AFTER the TKN file is Saved it is OK to Press [OK] "
do
res = fileExists(DestPath1,fnamenobas;".exe"
if res then exit do
scan
loop until res = 1
'################################################################################
'inform user and create a pause for WindowsOS to catch up
do
z = z + 1
#main.info, "Copying jbrun2.exe to New Project Dir + rename . .. .. . .."
#main.3, "Gettin er done > > > >"
loop until z = 3
z = 0
open JBpath$;"\";JBruntime$ for input as #file
open DestPath1$;"\";JBruntime$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
call pause 300
name DestPath1$;"\";JBruntime$ as DestPath1$;"\";fnamenobas$ + ".exe"
do
z = z + 1
#main.info, "Copying DLL and SLL Files to New Project Dir .. . .. .. "
#main.3, "Gettin er done > > > >"
call pause 100
loop until z = 1
z = 0
'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$
open from$ for input as #file
open to$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
'run "cmd.exe /c copy ";qq$;from$;qq$;" ";qq$;to$;qq$
wend
'inform user and create a pause for WindowsOS to catch up
do
z = z + 1
#main.info, "Almost done . ... . . . .."
#main.3, "Gettin er done > > > >"
call pause 100
loop until z = 1
z = 0
'check if dll's sll's and jbrun2.exe were copied to current project folder
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
res=fileExists(DestPath1$,fnamenobas$;".exe")
if res then a=a+1 else notice "jbrun2.exe not copied or renamed - EXITING ": close #main : end
'check for new tkn existence
tkn$ = fnamenobas$;".tkn"
res=fileExists(DestPath1$,tkn$)
if res then a=a+1 else notice "The TKN File was not created - EXITING" : close #main : end
'inform user and create a pause for WindowsOS to catch up
do
z=z+1
#main.info, "Project Created all files acounted for ..... please wait."
#main.3, "<<<< GOT er >>>> ! DONE ! <<<<< ! Yeah ! >>>>"
call pause 100
loop until z = 50
z=0
'##################################################################
'Make add folders\files\buttons for Run Project, Make exe, Browse, Remove source window
[include]
close #main
WindowWidth = 600
WindowHeight = 320
UpperLeftX=INT((DisplayWidth-WindowWidth)/2)
UpperLeftY=INT((DisplayHeight-WindowHeight)/2)
BackgroundColor$ = "lightgray"
ForegroundColor$ = "black"
statictext #include.header, "Add Files or Folders to this Project", 145, 35, 350, 35
statictext #include.jbforums, "Visit https://justbasiccom.proboards.com/", 160, 250, 450, 35
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], "Back to Main Menu", [back], "Exit 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 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 :D", [kickhard]
menu #include, "Help", "Help", [help], "About", [about]
open "Options For This New Project" for window_nf as #include
#include, "trapclose [quit.include]"
#include, "font Arial 10 bold"
#include.header, "!font Arial 14 bold"
#include.remsource, "!font Arial 12 bold"
#include.back, "!font Arial 12 bold"
#include.browseN, "!font Arial 12 bold"
#include.browseP, "!font Arial 12 bold"
#include.makeinst, "!font Arial 12 bold"
#include.run, "!font Arial 12 bold"
wait
'code for making the Added Files\Folders Running Project, Make EXE Browsing Project(s)
[tknonly]
notice "TKN file in folder with Selected .bas file" + chr$(13) + "Enter or OK to continue TKN"
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$
wait
[kickhard]
notice "OUCH!! I DESERVE MANY MORE - You OWE me!! "
wait
[bmpf]
bmp$ = "bmp"
res = mkdir(DestPath1$;"\";bmp$)
filedialog "Open a bmp File - (.bmp)", DefaultDir$;"\";"*.bmp", FullPathbmpFile$
if FullPathbmpFile$ = "" then notice "No Folder Chosen = No Folder or File Copied" : goto [nobmp]
bmpFile$ = FullPathbmpFile$
bmpFile$ = GetFilename$(bmpFile$)
if fileExists(DestPath1$;"\";bmp$, bmpFile$) then kill DestPath1$;"\";bmp$;"\";bmpFile$
if bmpFile$ = "" then goto [nobmp]
open FullPathbmpFile$ for input as #file
open DestPath1$;"\";bmp$;"\";bmpFile$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
[nobmp]
res=fileExists(DestPath1$;"\";bmp$,bmpFile$)
if res and val(bmpFile$) > 0 then a = a + 1 else notice "No bmpFile was copied" : wait
message$ = bmpFile$;" was copied to ";DestPath1$;"\";bmp$
if messagetoggle = 1 then wait
message$ = GetMessage$(message$)
wait
[medf]
media$ = "media"
res = mkdir( DestPath1$;"\";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 kill DestPath1$;"\";media$;"\";mediaFile$
if mediaFile$ = "" then notice "No File Copied" : goto [nomedia]
open FullPathmediaFile$ for input as #file
open DestPath1$;"\";media$;"\";mediaFile$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
[nomedia]
if res and val(mediaFile$) > 0 then a = a + 1 else notice "No Media File was copied" : wait
message$ = mediaFile$;" was copied to ";DestPath1$;"\";media$
if messagetoggle = 1 then wait
message$ = GetMessage$(message$)
wait
[appf]
apps$ = "apps"
res = mkdir( DestPath1$;"\";apps$)
filedialog "Open an Executable File (.exe 'etc')", DefaultDir$;"\";"*.*", FullPathappFile$
if FullPathappFile$ = "" then notice "No Folder Chosen = No Folder or File Copied" : goto [noapp]
appFile$ = FullPathappFile$
appFile$ = GetFilename$(FullPathappFile$)
if fileExists(DestPath1$;"\";apps$, appFile$) then kill DestPath1$;"\";apps$;"\";appFile$
open FullPathappFile$ for input as #file
open DestPath1$;"\";apps$;"\";appFile$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
[noapp]
if res and val(appFile$) > 0 then a = a + 1 else notice "No app File was copied" : wait
message$ = appFile$;" was copied to ";DestPath1$;"\";apps$
if messagetoggle = 1 then wait
message$ = GetMessage$(message$)
wait
[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" : goto [nopath]
res = mkdir( DestPath1$;"\";userDir$)
filedialog "Add a File to Folder that was Just Created", DefaultDir$;"\";"*.*", FullPathuserFile$
if FullPathuserFile$ = "" then notice "No File Chosen = No File Copied" : goto [nopath]
userFile$ = FullPathuserFile$
userFile$ = GetFilename$(userFile$)
if fileExists(DestPath1$;"\";userDir$, userFile$) then kill DestPath1$;"\";userDir$;"\";userFile$
open FullPathuserFile$ for input as #file
open DestPath1$;"\";userDir$;"\";userFile$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
[nopath]
if res and val(userFile$) > 0 then a = a + 1 else notice "No chosen File was copied" : wait
message$ = userFile$;" was copied to ";DestPath1$;"\";user$
if messagetoggle = 1 then wait
message$ = GetMessage$(message$)
wait
[rootf]
filedialog "Add Files to root of New Project Dir", "c:\*.*", FullPathrootFile$
if FullPathrootFile$ = "" then notice "No File Chosen = No File Copied" : goto [noroot]
rootFile$ = FullPathbrootFile$
rootFile$ = GetFilename$(rootFile$)
if fileExists(DestPath1$, rootFiile$) then kill DestPath1$;"\";rootFile$
open FullPathrootFile$ for input as #file
open DestPath1$;"\";rootFile$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
[noroot]
res = fileExists(DestPath1$, rootFiile$)
if res and val(rootFile$) > 0 then a = a + 1 else notice "No File was copied to ";DestPath1$ : wait
message$ = bmpFile$;" was copied to ";DestPath1$;"\";bmp$
if messagetoggle = 1 then wait
message$ = GetMessage$(message$)
wait
'code for removing the .bas source file from the current project folder
[remsource]
delFile$ = "yes"
confirm "Are you sure you want to delete this source code file?";delFile$
if delFile$ = "" then wait
if delFile$ <> "no" then kill DestPath1$;"\";fname0$ : wait
res = fileExists(DestPath1$,fname0$)
if res <> 1 then a = a + 1 else message$ = GetMessage$( "Source File was NOT deleted from");DestPath1$ : wait
message$ = fname0$;" Was deleted from ";DestPath1$
if messagetoggle = 1 then wait
message$ = GetMessage$(message$)
wait
'go back to main menu (user can select a new .bas file and start again)
[back]
close #include
end
'starts iexpress.exe (a built in Windows Install maker self extracting exe)
[makeinst]
res=fileExists("c:\windows\system32","iexpress.exe")
if res then run "c:\windows\system32\iexpress.exe" else notice " Cannot find file --> iexpress.exe in c:\windows\systm32"
wait
'open Windows explorer to the Just Basic Projects Folder
[browseP]
run "explorer.exe ";DestPath$
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
[orig]
run "explorer ";orig$
wait
[help]
notice "Help file coming in future zip version"
wait
[about]
notice, "About file coming in future zip version"
wait
'done with adding folders\files etc - close P.O.
[exit]
close #include
end
'done with adding folders\files etc, restart Project Organizer
[quit.include]
close #include
goto [start]
'close open windows and exit program
[quit.main]
close #main
end
'Change Just basic Projects Path (useing folderdialog window)
[fdiaginiedit]
ini$ = FolderDialog$("Select a Drive or Folder for JB Projects Dir - Note: Only Drives & Folders Show Below (No Files)")
if ini$ = "" then notice "No Path given = No Path Saved"
if right$(ini$, 1) = "\" then ini$ = left$(ini$, len(ini$) - 1)
open "PO.ini" for output as #iniedit
print #iniedit, ini$
close #iniedit
if ini$ = "" then kill "PO.ini"
wait
'Change Just basic Projects Path (type it yourself)
[editini]
prompt "Change Just Basic Projects Default Path" + chr$(13) + "Type a New Default Path" ; iniedit$
if iniedit$ = "" then notice "No Path given = No Path Saved"
if right$(iniedit$, 1) = "\" then iniedit$ = left$(iniedit$, len(iniedit$) - 1)
open "PO.ini" for output as #ini
print #ini, iniedit$
close #ini
if iniedit$ = "" then kill "PO.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"
ini$ = "PO.ini"
open ini$ for output as #destpref
print #destpref, DestPath$
close #destpref
if DestPath$ = "" then kill "PO.ini"
return
'check if PO.ini exists, if it does, then use it's contents as the user choice path (DestPath$)
[DestPathLog]
res=fileExists(DestPath1$,"PO.ini")
if res <> 1 then return
open "PO.ini" for input as #ini
line input #ini, logged$
if right$(logged$, 1) = "\" then logged$ = left$(logged$, len(logged$) - 1)
close #ini
if logged$ = "" then kill "PO.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 = 320
UpperLeftX=INT((DisplayWidth-WindowWidth)/2)
UpperLeftY=INT((DisplayHeight-WindowHeight)/2)
BackgroundColor$ = "lightgray"
ForegroundColor$ = "black"
gosub [FolderDlgGetDrives]
statictext #folderdlg.S, "Select a Drive or a Folder From the List", 145, 10, 300, 25
statictext #folderdlg.D, " (Double Click Drive Letters and Folders to Select or Navigate)", 60, 40, 425, 20
listbox #folderdlg.list, FolderList$(, [FolderDlgSelect], 22, 60, 550, 130
button #folderdlg.default, "&Ok", [FolderDlgOk], UL, 195, 250, 80, 30
button #folderdlg.B, "Back", [FolderDlgBack], UL, 490, 15, 80, 30
button #folderdlg.C, "&Cancel", [FolderDlgCancel], UL, 290, 250, 80, 30
textbox #folderdlg.text, 150, 195, 290, 25
statictext #folderdlg.path, "Selected Drive or Folder Path Appears Here", 155, 225, 400, 20
open caption$ for dialog_modal as #folderdlg
print #folderdlg, "trapclose [FolderDlgCancel]"
print #folderdlg, "font Arial 12 bold"
#folderdlg.path, "!font Arial 10 bold"
#folderdlg.D, "!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$"
[FolderDlgCancel]
close #folderdlg
end function
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 8"
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 :D - for now!
'th th th th th that's all folks :D - for now!
For Linux Users Using WINE Updated because it wasn't working March 12 2021
'New Release of Version v.009.01L March 12 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.009.01L 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 memroy 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]
projects$ = "Just Basic Projects" ' Default Name if user wants to use it
titlebar "Project Organizer v.009.01L for Just Basic v2.0"
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
'if user DestPath$ is logged already, use it
if fileExists(DefaultDir$, "PO.ini") then gosub [DestPathLogCheck]
if logged$ = "" then a = a + 1 else DestPath$ = logged$ : goto [checkjbpath]
'projects$ = Default Just Basic Projects Folder (User Can Change Name When P.O. is Run First Time or if \ when user changes \ edits it)
[start]
res=fileExists(DefaultDir$,"PO.ini")
if res then a = a + 1 else goto [GetDestPath]
'PO.ini can be found in the Same Folder Project Organizer is Started From After First Run
'check for PO.ini file
ini$ = "PO.ini"
open ini$ for input as #destpref
while eof(#destpref) = 0
line input #destpref, jbprojectsDir$
DestPath$ = jbprojectsDir$
wend
'Copy Projects Folder Path from PO.ini to become DestPath$ (Projects Folder)
close #destpref
ini$ = "PO.ini"
open ini$ for output as #logDestPath
print #logDestPath, DestPath$
close #logDestPath
if DestPath$ = "" then a = a + 1 else goto [checkjbpath]
'ask user for choice of Projects Folder Name using FolderDialog window
[GetDestPath]
DestPath$ = FolderDialog$("Select Drive or Folder for JB Projects Dir - Note: Only Drives & Folders Shown Below (No Files)")
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
[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"
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)
[go]
'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
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 and some buttons to the Window
statictext #main.header, "Project Organizer v.009.01L for Just Basic v2.0", 90, 20, 590, 35
statictext #main.1, "Select a .bas file from your Just Basic v2.0 source collection", 75, 55, 590, 25
statictext #main.2, "Provide a Path to a Folder or Drive to put your Projects Folder", 75, 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)", 40, 175, 590, 35
statictext #main.jbforums, "Visit the Just Basic Forums @ https://justbasiccom.proboards.com/", 80, 255, 590, 20
button #main.default, "Select File", [defaultClick],UL 170, 210, 135, 35
button #main.cancel, "Cancel", [cancelClick],UL 320, 210, 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, "Browse", "Browse Your Just Basic Projects Folder ", [browseP]
menu #main, "Help", "Help", [help], "About", [about]
'open the Window, and set some Fonts for each statictext, and buttons
open "Project Organizer v.009.01L for Just Basic v2.0" for window_nf as #main
#main, "trapclose [quit.main]"
#main, "font Arial 8 bold"
#main.header, "!font Arial 10 bold"
#main.1, "!font Arial 8 bold"
#main.2, "!font Arial 8 bold"
#main.3, "!font Arial 8 bold"
#main.4, "!font Arial 8 bold"
#main.5, "!font Arial 10 bold"
#main.info, "!font Arial 10 bold"
#main.jbforums "!font Arial 6 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
'check if PO.ini already exists
res=fileExists(DefaultDir$,"PO.ini")
'check again for User's Projects Folder - Just in case a crash occurs if DestPath$ = ""
'Note to Self - check if this is needed when I have time.
if DestPath$ = "" then notice "No Folder Path given, closing JB Program Organizer": goto [quit.main]
goto [begin]
'wait
'if user cancels from main menu
'start making DestPath , DestPath1 folders and copying needed files
[begin]
'change text of main dialog window as the show begins
#main.header, "Creating Dirs, Copying Files to Project Dir"
#main.default, "!hide"
#main.1, "!hide"
#main.2, "!hide"
#main.3, "DON'T CLICK the NOTICE POPUP until TKN File is Saved"
#main.4, "!hide"
#main.5, "!hide"
#main.info, "!font Arial 10 bold"
#main.3, "!font Arial 10 bold"
' define DestPathU$ as the JB Projects Path Plus then Path of the Current Project Name
DestPathU$ = DestPath$;"\";projects$
'inform user of the progress
do
z = z + 1
#main.info, "Creating Projects Folder .... . .. "
call pause 100
loop until z = 6
z=0
'define Destpath1$ as JB Projects\Current Project
DestPath1$=DestPathU$;"\";fnamenobas$
'Make Folders for Just Basic Projects and Current ProjectName
'res = mkdir( DestPath$)
res = mkdir(DestPathU$)
res = mkdir( DestPath1$)
'inform user of Progress
do
z = z + 1
#main.info, "Copying Selected .bas File to New Folder"
call pause 100
loop until z = 6
z=0
'Check if Just Basic Projects Folder and New Project Folder were created
'res=pathExists(DestPath$)
'if res then a = a + 1 else notice "JB Projects Dir was NOT Created in ";DestPath$ : close #main : end
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
'inform user of Progress
do
z = z + 1
#main.info, "Copying BAS file to New Project Dir . ... .. "
call pause 100
loop until z = 6
z=0
'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
'inform user of Progress
do
z = z + 1
#main.info, "Creating TKN File in New Project Dir . ... .. "
call pause 100
loop until z = 10
z=0
'################################################################################
'Create the TKN file. A good time to cross your fingers :D
'Getting to this pont cost me a new wig & 2 bottles of Rogain :D
RUN JBpath$;"\";JBexe$;" -T -A ";DestPath1$;"\";fname0$
'add a notice to halt program until TKN file is saved
'notice "AFTER the TKN file is Saved it is OK to Press [OK] "
do
res = fileExists(DestPath1,fnamenobas;".exe"
if res then exit do
scan
loop until res = 1
'################################################################################
'inform user of Progress
do
z = z + 1
#main.info, "Copying jbrun2.exe, 5 dll files, & 3 sll Files"
#main.3, "Renaming jbrun2.exe to name of Selected .bas File"
call pause 100
loop until z = 6
z = 0
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"
'inform user of Progress
do
z = z + 1
#main.info, "Finishing up"
#main.3, "So far going well"
call pause 100
loop until z = 10
z = 0
'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
'inform user of Progress
do
z = z + 1
#main.info, "Almost done . ... . . . .."
#main.3, "Verifying Files were copied and renamed "
call pause 100
loop until z = 10
z = 0
'check if dll's sll's and jbrun2.exe were copied to current project folder
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
'check for new tkn existence
tkn$ = fnamenobas$;".tkn"
res=fileExists(DestPath1$,tkn$)
if res then a=a+1 else notice "The TKN File was not created - EXITING" : close #main : end
'inform user of Progress
do
z=z+1
#main.info, "Project Created all files acounted for ..... please wait."
#main.3, " >>>>> !DONE ! <<<<< "
call pause 100
loop until z = 50
z=0
'##################################################################
'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/", 160, 250, 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], "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 :D", [kickhard]
menu #include, "Help", "Help", [help], "About", [about]
'Set Font's for this window ,
open "Options For This New Project" for window_nf as #include
#include, "trapclose [quit.include]"
#include, "font Arial 8 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
'code for making the Added Files\Folders Running Project, Make EXE Browsing Project(s)
[tknonly]
'When Creating a TKN File it is Created in Same Folder as the .bas File Selected (No Choice Allowed)
confirm "TKN File in Same Dir as Selected .bas File" + chr$(13) + "Sorry No Choice [OK] to Make TKN ONLY";answer$
if answer$ = "yes" then a = a + 1 else wait
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$
wait
'just a joke to relieve some stress
[kickhard]
notice "OUCH!! I DESERVE MANY MORE - You OWE me!! "
wait
'Make a bmp Folder in the Current Project Folder Automatically, then Ask For .bmp File to
' Add to it. Same Goes for All Folders being Created in Projects Folder
[bmpf]
bmp$ = "bmp"
res = mkdir( DestPath1$;"\";bmp$)
filedialog "Open a bmp File - (.bmp)", DefaultDir$;"\";"*.bmp", FullPathbmpFile$
if FullPathbmpFile$ = "" then notice "No Folder Chosen = No Folder or File Copied" : goto [nobmp]
bmpFile$ = FullPathbmpFile$
bmpFile$ = GetFilename$(bmpFile$)
if fileExists(DestPath1$;"\";bmp$, bmpFile$) then kill DestPath1$;"\";bmp$;"\";bmpFile$
if bmpFile$ = "" then Notice "No File Copied - Folder was Automatic" : goto [nobmp]
open FullPathbmpFile$ for input as #file
open DestPath1$;"\";bmp$;"\";bmpFile$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
call pause 300
[nobmp]
res=fileExists(DestPath1$;"\";bmp$,bmpFile$)
if res then notice bmpFile$;" Was created in ";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"
res = mkdir( DestPath1$;"\";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 kill DestPath1$;"\";media$;"\";mediaFile$
if mediaFile$ = "" then notice "No File Copied" : goto [nomedia]
open FullPathmediaFile$ for input as #file
open DestPath1$;"\";media$;"\";mediaFile$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
call pause 300
[nomedia]
res=fileExists(DestPath1$;"\";media$,mediaFile$)
if res then notice mediaFile$;" 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"
res = mkdir( DestPath1$;"\";apps$)
filedialog "Open an Executable File (.exe 'etc')", DefaultDir$;"\";"*.*", FullPathappFile$
if FullPathappFile$ = "" then notice "No Folder Chosen = No Folder or File Copied" : goto [noapp]
appFile$ = FullPathappFile$
appFile$ = GetFilename$(FullPathappFile$)
if fileExists(DestPath1$;"\";apps$, appFile$) then kill DestPath1$;"\";apps$;"\";appFile$
open FullPathappFile$ for input as #file
open DestPath1$;"\";apps$;"\";appFile$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
[noapp]
call pause 300
res=fileExists(DestPath1$,appFile$)
if res then notice appFile$;" Was added 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" : goto [nopath]
res = mkdir( DestPath1$;"\";userDir$)
filedialog "Add a File to Folder that was Just Created", DefaultDir$;"\";"*.*", FullPathuserFile$
if FullPathuserFile$ = "" then notice "No File Chosen = No File Copied" : goto [nopath]
userFile$ = FullPathuserFile$
userFile$ = GetFilename$(userFile$)
if fileExists(DestPath1$;"\";userDir$, userFile$) then kill DestPath1$;"\";userDir$;"\";userFile$
open FullPathuserFile$ for input as #file
open DestPath1$;"\";userDir$;"\";userFile$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
call pause 300
[nopath]
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" : goto [noroot]
rootFile$ = FullPathbrootFile$
rootFile$ = GetFilename$(rootFile$)
if fileExists(DestPath1$, rootFiile$) then kill DestPath1$;"\";rootFile$
open FullPathrootFile$ for input as #file
open DestPath1$;"\";rootFile$ for output as #1
print #1, input$(#file, lof(#file));
close #file
close #1
call pause 300
[noroot]
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't Affect Original .bas";delFile$
if delFile$ = "" then goto [include]
res=fileExists(DestPath1$,fname0$)
if left$(delFile$, 1) = "y" or left$(delFile$, 1) = "Y" and res then kill DestPath1$;"\";fname0$
call pause 350
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 "c:\windows\system32\iexpress.exe" else notice " Cannot find file --> iexpress.exe in c:\windows\systm32"
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
goto [restart]
[cancelClick]
close #main
end
'done with adding folders\files etc
[quit.include]
close #include
goto [restart]
'close main window and exit program
[quit.main]
close #main
end
'Change Just Basic Projects Path (useing 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" : goto [nochange]
'Remove trailing \ from Path returned from FolderDialog Function
if right$(DestPath$, 1) = "\" then DestPath$ = left$(DestPath$, len(DestPath$) - 1)
open "PO.ini" for output as #iniedit
print #iniedit, DestPath$
close #iniedit
[nochange]
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" : goto [noedit]
if right$(iniedit$, 1) = "\" then iniedit$ = left$(iniedit$, len(iniedit$) - 1)
open "PO.ini" for output as #ini
print #ini, iniedit$
close #ini
[noedit]
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 #destpref
print #destpref, DestPath$
close #destpref
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$) upon 'return' else put it check
[DestPathLogCheck]
res=fileExists(DestPath1$,"PO.ini")
if res <> 1 then a = a + 1 : return
open "PO.ini" for input as #ini
line input #ini, logged$
if logged$ = "" then a = a + 1 : return
if right$(logged$, 1) = "\" then logged$ = left$(logged$, len(logged$) - 1)
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 = 340
UpperLeftX=INT((DisplayWidth-WindowWidth)/2)
UpperLeftY=INT((DisplayHeight-WindowHeight)/2)
BackgroundColor$ = "lightgray"
ForegroundColor$ = "black"
gosub [FolderDlgGetDrives]
statictext #folderdlg.S, "Select a Drive or a Folder From the List", 145, 10, 300, 25
statictext #folderdlg.D, " (Double Click Drive Letters and Folders to Select or Navigate)", 60, 40, 425, 20
listbox #folderdlg.list, FolderList$(, [FolderDlgSelect], 22, 60, 550, 130
button #folderdlg.default, "&Ok", [FolderDlgOk], UL, 195, 250, 80, 30
button #folderdlg.B, "Back", [FolderDlgBack], UL, 490, 15, 80, 30
button #folderdlg.C, "&Cancel", [FolderDlgCancel], UL, 290, 250, 80, 30
textbox #folderdlg.text, 150, 195, 290, 25
statictext #folderdlg.path, "Selected Drive or Folder Path Appears Here", 155, 225, 400, 20
open caption$ for dialog_modal as #folderdlg
print #folderdlg, "trapclose [FolderDlgCancel]"
print #folderdlg, "font Arial 10 bold"
#folderdlg.path, "!font Arial 6 bold"
#folderdlg.D, "!font Arial 8 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$"
[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
'th th th th th that's all folks :D - for now!