Microsoft Small Basic

Program Listing: MSNS590.000
'===REQUIREMENTS===
'ZS extension (DLL + XML file/intellisense, via SB Prime Extension Manager or repo at github.com/zs-3/ZS/releases)
'LD extension (DLL + XML, download at litdev.uk/#Extensions or via SB Prime Extension Manager, though might auto download)
'Version 2.0_01
LDTextWindow.KeyDown = GetKeyHandler
menuitems[1] = "Help for google.COM:"
menuitems[2] = " - None of these have parameters (params)!"
menuitems[3] = " google - Traditional search;"
menuitems[4] = " lucky - Random search;"
menuitems[5] = " ping - Ping a server;"
menuitems[6] = " tracert - Trace the route of a connection to a server;"
menuitems[7] = " wwwbasic - wwwBASIC: some classic BASIC for the web. Literally you hoped no BASIC dialects for Google Terminal?;"
menuitems[8] = " mnu - Display this menu;"
menuitems[9] = " $cls - Clear the terminal (dollar sign = run as admin);"
menuitems[10] = " exit - Exit google.COM."
Sub TimeProgram
TextWindow.WriteLine("PRESS ESC TO STOP ...")
timeprogramruntime = 1
ZSThread.RunSub("GetKeyHandler")
While timeprogramruntime = 1
TextWindow.WriteLine(Clock.Time)
Program.Delay(1000)
EndWhile
EndSub
Sub GetKeyHandler
If LDTextWindow.LastKey = "Escape" Then
If timeprogramruntime = 1 Then
timeprogramruntime = 0
EndIf
EndIf
EndSub
Sub ExitToMainDOS
TextWindow.Write("C:\NET\TOOLS\GOOGLE>")
Program.Delay(90)
TextWindow.PauseWithoutMessage()
Program.End()
EndSub
Sub Banner
banner_rt[1] = "Copyright 1998 Google Inc."
banner_rt[2] = "Inspired in 2025 by Elgoog.im/terminal"
For i=1 To array.GetItemCount(banner_rt)
TextWindow.WriteLine(banner_rt[i])
Program.Delay(100)
EndFor
EndSub
Sub IsConnected
getresultnet = ZSNetwork.IsInternetAvailable()
EndSub
IsConnected()
Sub Warn
TextWindow.ForegroundColor = "Yellow"
TextWindow.Write("WARNING: ")
TextWindow.ForegroundColor = DefaultColor
EndSub
Sub Error
TextWindow.ForegroundColor = "Red"
TextWindow.Write("ERROR: ")
TextWindow.ForegroundColor = DefaultColor
EndSub
Sub LineBreak
TextWindow.WriteLine("")
EndSub
Sub PauseNoMsg
TextWindow.WriteLine("PRESS ANY KEY TO CONTINUE ... ")
TextWindow.PauseWithoutMessage()
EndSub
Sub SetToDefaultColor
TextWindow.ForegroundColor = DefaultColor
EndSub
Sub Logo
TextWindow.ForegroundColor = "Blue"
TextWindow.Write("G")
TextWindow.ForegroundColor = "Green"
TextWindow.Write("O")
TextWindow.ForegroundColor = "Red"
TextWindow.Write("O")
TextWindow.ForegroundColor = "Yellow"
TextWindow.Write("G")
TextWindow.ForegroundColor = "Blue"
TextWindow.Write("L")
TextWindow.ForegroundColor = "Green"
TextWindow.Write("E")
TextWindow.ForegroundColor = "Red"
TextWindow.Write("!")
SetToDefaultColor()
EndSub
Sub Search
TextWindow.WriteLine("")
TextWindow.Write("What'd you like to search?")
getsearch = TextWindow.Read()
preparsedsearch = ZSText.UrlEncode(getsearch)
parsedsearch = LDText.Replace(preparsedsearch," ","+")
LDProcess.Start("https://google.com/search?hl=en-us&udm=14&q="+parsedsearch,"")
EndSub
Sub RedirectsOrHandlers
If readprompt = "wwwbasic" Then
TextWindow.Write("Go to repository[1], editor[2] or abort[a]? (1/2/a)")
getoption1 = TextWindow.Read()
If getoption1 = 1 Then
LDProcess.Start("https://github.com/google/wwwbasic","")
ElseIf getoption1 = 2 Then
LDProcess.Start("https://google.github.io/wwwbasic/examples/editor.html","")
ElseIf getoption1 = "a" Then
'(nothing)
Else
'(nothing)
EndIf
ElseIf readprompt = "google" Then
Search()
ElseIf readprompt = "ping" Then
TextWindow.Write("Type in host URL to ping-")
gethost = TextWindow.Read()
getpingresults = ZSCmd.PingHost(gethost)
For i=1 To Array.GetItemCount(getpingresults)
TextWindow.WriteLine(getpingresults[i])
EndFor
ElseIf readprompt = "tracert" Then
TextWindow.Write("Type in host URL to trace route-")
gethost1 = TextWindow.Read()
getresults = ZSCmd.Execute("tracert "+gethost1)
For i=1 To Array.GetItemCount(getresults)
TextWindow.WriteLine(getresults[i])
EndFor
ElseIf readprompt = "lucky" Then
LDProcess.Start("https://www.google.com/search?btnI=I","")
ElseIf readprompt = "mnu" Then
ShowMenu()
ElseIf readprompt = "cls" Then
Error()
TextWindow.Write("The command must be run with administrator privileges (dollar sign before command).")
LineBreak()
ElseIf readprompt = "$cls" Then
Program.Delay(50)
TextWindow.Clear()
ElseIf readprompt = "exit" Then
LineBreak()
TextWindow.Write("Exiting google.COM")
For i=1 To 6
TextWindow.Write(".")
Program.Delay(1000)
EndFor
LineBreak()
ExitToMainDOS()
ElseIf readprompt = "dir" Then
nfs[1] = "FILENAME | BYTES"
nfs[2] = "NFS:\GOOGLE\INDEX.BIN | 42991616"
nfs[3] = "NFS:\GOOGLE\ROOT.SYS | 14680064"
nfs[4] = "NFS:\GOOGLE\MAIN.COM | 18947768.32"
nfs[5] = "NFS:\GOOGLE\TIME.COM | 69632"
For i=1 To Array.GetItemCount(nfs)
TextWindow.WriteLine(nfs[i])
Program.Delay(100)
EndFor
ElseIf readprompt = "" Then
'(nothing)
ElseIf readprompt = "time" Then
TimeProgram()
Else
LineBreak()
Error()
TextWindow.Write("This command is unknown: "+readprompt)
LineBreak()
EndIf
EndSub
Sub Menu
For i=1 To Array.GetItemCount(menuitems)
TextWindow.WriteLine(menuitems[i])
Program.Delay(50)
EndFor
LoopCmd()
EndSub
Sub ShowMenu
For i=1 To Array.GetItemCount(menuitems)
TextWindow.WriteLine(menuitems[i])
Program.Delay(50)
EndFor
EndSub
Sub LoopCmd
While "True"
TextWindow.Write("NFS:\GOOGLE>")
readprompt = TextWindow.Read()
RedirectsOrHandlers()
EndWhile
EndSub
TextWindow.Title = "DOSBox (MS-DOS)"
DefaultColor = TextWindow.ForegroundColor
TextWindow.Write("C:\NET\TOOLS\GOOGLE>")
totype[1] = "g"
totype[2] = "o"
totype[3] = "o"
totype[4] = "g"
totype[5] = "l"
totype[6] = "e"
totype[7] = "."
totype[8] = "C"
totype[9] = "O"
totype[10] = "M"

For i=1 To Array.GetItemCount(totype)
TextWindow.Write(totype[i])
Program.Delay(70)
EndFor

TextWindow.WriteLine("")
TextWindow.Title = "Google Terminal 8981"
TextWindow.ForegroundColor = "Yellow"
TextWindow.Write("WARNING: ")
TextWindow.ForegroundColor = DefaultColor
TextWindow.Write("It is recommended to run this simulation with a really fitting typeface style! Right-click the title bar, click 'Properties', go to 'Font' and scroll until you find 'Raster Fonts', then select it, then select 7x12 on the 'Size' section and click 'OK' (works best on Win10/11, maybe needed on 8/8.1 but highly unlikely on 7 though)")
TextWindow.WriteLine("")
PauseNoMsg()
Banner()
TextWindow.WriteLine("")
TextWindow.Write("Google is starting")
For i=1 To 10
TextWindow.Write(".")
Program.Delay(100)
EndFor

If getresultnet = "true" Then
TextWindow.WriteLine("")
For i=1 To 6
TextWindow.WriteLine("")
EndFor

Logo()
TextWindow.WriteLine("")
Menu()
Else
TextWindow.WriteLine("")
TextWindow.ForegroundColor = "Red"
TextWindow.Write("ERROR: ")
SetToDefaultColor()
TextWindow.Write("No connection found.")
LineBreak()
PauseNoMsg()
ExitToMainDOS()
EndIf