Using Batch files with Liberty BASIC
Overview: Expediting and expanding the capabilities of Liberty BASIC with Batch files
I've only come across a few examples in the past of someone using batch files with Liberty BASIC, but Microsoft has provided a treasure of functions which can be run from the command prompt or a batch file, and Liberty BASIC can easily utilize these to expand or improve it's performance.
Here's a simple example for pinging a website to see if it's online or not and how fast the connection is to demonstrate how much easier this can be done with a batch file than by using 3rd party DLL's to connect Liberty BASIC to the Internet: (works on Windows XP, not sure on lower versions as I haven't checked)
'START OF LIBERTY BASIC vs. 3.x CODE
'Example for using batch files to easily expand LB's capabilities
'Free to use and abuse as you see fit'create a batch file that will ping your server
open "newping.bat" for output as #1
'change the directory to C: - can be any letter drive and path you want to use
#1, "cd c:\"
'change the website address to whatever your address is
'the >ping.txt tells the batch file to write the results of the ping to a
'temp file named ping.txt in the directory we set above with the cd c:\ command
#1, "ping www.lbdownloads.com >ping.txt"
close #1run "newping.bat", HIDE ' runs the batch file created above / HIDE prevents the commandline box from being displayed
call Pause 15000 'give connection 15 seconds to respond (raise to 30 seconds for dial-up connections)
open "C:\ping.txt" for input as #2 'open the temp file and read the results
while eof(#2) = 0
line input #2, temp$
print temp$ 'print results to main window
wend
close #2kill "C:\ping.txt" 'delete temp file
kill "newping.bat" 'delete batch file
endsub Pause mil
t=time$("milliseconds")
while time$("milliseconds")
Using the same methods a full-service telnet program, FTP program and more (perhaps an independant Liberty BASIC browser?) is at your fingertips.
As I mentioned, there are more than just Internet uses for using batch files. For full documentation on what can be done from the command prompt (and batch files) in XP check this out: www.microsoft.com documentation