My programming skills are intermediate at best, newbie beginner at my worst..
Even though I've spend a lot of time with many different languages over the years, I have never pushed myself to anywhere near expert level. But I love writing and reading code, and I persevere.
I use LB Booster, but only(so far) to boost my Liberty Basic bas files and create the boosted exe files
That said I have developed a program to automate the progress. It isn't perfect but here on my PC it gets the job done.
The issue with others would be the timing of the automation. If anyone wishes to take a look, and help make it better I'm all ears and appreciate the help.
The size of the .bas file selected, and the capability of the Users hardware need to be addressed somehow in the code.
Please read the top of the code for instructions and a better understanding of how it works.
The code
Code: Select all
'QuickEXE using LB Booster (Automated)
'Download LBB.exe and LBRUN.exe from this page - http://lbbooster.com/
'Save them to the same folder as this file RUN's from (DefaultDir$)
'created by xxgeek
'Sept 2023
'Edited Nov 2023
Be AWARE
'Copy this code to a file in a folder of it's own before RUN'ing (QuickEXE will create files in it's folder)
'QuickEXE:
'Copies the selected .bas file to DefaultDir$, then automates LBB exe file creation to create the new EXE file in DefaultDir$(same folder this code is RUN'ing from)
'Overwrites any existing .bas file of same name in DefaultDir$.Does not affect Original file
'If existing EXE file of same name resides in DefaultDir$ Automation Stops
'_ and the User is asked to Overwrite. Does not affect Original unless confirmed by user.
'_ the User must manually close the Information window showing the path to "Saved As" file
'There may be a window pop up asking to overwrite an existing exe file of same name
'The automation takes care of that too after a couple of seconds, defaulted to "No" by design" :)
'Please Wait Long Enough
'If you wait, and no existing filename of the new exe file exists, all open windows will/should close eventually. No need to start closing windows manually, and if you do will most likely cause a crash, or no exe file.
'Very tricky timing things in the code to suit any file size, or any old PC.
'If you have issues, we can try to work them out.
nomainwin
[LBB_EXE]
filedialog "Open a Liberty Basic Source File (.bas) ", "c:\*.bas", fname$
if instr(fname$, DefaultDir$) then notice chr$(13);"Selecting a File from within DefaultDir$ is NOT ALLOWED";chr$(13);chr$(13);"Try Again With a Different File" : end
if fname$ = "" then wait
cursor hourglass
LBB$ = DefaultDir$;"\LBB.exe"
fname0$ = GetFilename$(fname$)
open fname$ for input as #1
open fname0$ for output as #2
#2 input$(#1, lof(#1))
close #1
close #2
call writeAutoSaveLBB
run "wscript ";autoSaveLBB$
run LBB$;" -C -M -A ";DefaultDir$;"\";fname0$
selected$ = left$(fname0$, len(fname0$)-4)
do
scan
loop until fileExists(DefaultDir$, selected$;".exe")
call pause 9000
kill DefaultDir$;"\";autoSaveLBB$
file$ = selected$;".exe"
if fileExists(DefaultDir$, file$) then
run "explorer /select, ";file$
else
notice file$;" was NOT Created"
end if
cursor normal
end
sub writeAutoSaveLBB
q$ = chr$(34)
global autoSaveLBB$
autoSaveLBB$ = "autoSaveLBB.vbs"
open autoSaveLBB$ for output as #1
#1 "Set WshShell = WScript.CreateObject(";q$;"WScript.Shell";q$;")"
#1 "Do While Not WshShell.AppActivate(";q$;"Save standalone executable";q$;")"
#1 "Loop"
#1 "WshShell.AppActivate(";q$;"Save standalone executable";q$;")"
#1 "WshShell.SendKeys ";q$;"{ENTER}";q$
#1 "Wscript.Sleep(8000)"
#1 "WshShell.SendKeys ";q$;"{ENTER}";q$
#1 "Set WshShell = nothing"
close #1
end sub
'sub to create pauses in program
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 to separate filename from full path to file
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