I fondly remember Visual Basic, not the new shiny .NET version, but the old VB6 that was an excellent way to build applications, but was always a bit of a pain to install them afterwards as sometimes I would find myself disappearing down the ActiveX regsvr32 version rabbit hole.
But fortunately VB6 sort of lives on in VBScript and best of all you can run VB Script files directly by double clicking them in Windows 10.
Normally if I need to automate something I would see if it could be done with a batch file, or PowerShell script and if necessary get Visual Studio out and write the extras I need as one or more console applications, but it struck me that its possible that some of the things could be done in VBScript, and just put together in Notepad rather than full Visual Studio.
As a quick experiment and as it is Wednesday I thought I would knock together a small script that will do a bit of number juggling randomly and pick tonight’s lottery numbers. It took me just a couple of minutes to put together including a moment or two to refresh my memory on VB syntax, but it simply creates an array of numbers, loops around swapping them randomly and then displays the first six number in the array in a message box.
For reference the numbers it picked was 1, 13, 22, 29, 43, 57.
Option Explicit Randomize Dim numbers(59) Dim x,y,z,temp For x=0 to 59 numbers(x)=FormatNumber(x,0) next For x=0 to Rnd * 10000000 y=Rnd * 59 z=Rnd * 59 temp=numbers(y) numbers(y)=numbers(z) numbers(z)=temp next MsgBox "Numbers " + numbers(0) + "," + numbers(1) + ","+numbers(2) + "," +numbers(3) + ","+ numbers(4) + "," + numbers(5),vbOkOnly,"Numbers"
The code is really simple, and it was written in notepad and saved to my desktop as lottery.vbs and runs when I double click it.
VB Script has the advantage that it can access external libraries, and registry entries and also write back to the file system making it useful to automate lots of general housekeeping tasks.
The above code was just a bit of fun, but it might be worth digging out your old Visual Basic 6 knowledge and using VBScript for some small but repetitive system tasks.