- Aug
- 2,032
- 82
I am a frequent user of VBScript, and have added the following to TCC22 to make using VBScript functions easier;
I have created a library file;
...which I load via my 4Start.btm (TCStart.btm) file as;
I have also defined a function in my function.lst file as;
...which I load via my 4Start.btm (TCStart.btm) file as;
Now, I can use a single VBScript function, for example;
..or
Other examples;
Joe
I have created a library file;
Code:
vb {
@setlocal
@echo off
echo set fso=CreateObject("Scripting.FileSystemObject") > c:\utils\vb.vbs
echo set stdout=fso.GetStandardStream(1) >> c:\utils\vb.vbs
echo stdout.WriteLine %* >> c:\utils\vb.vbs
echo set fso=Nothing >> c:\utils\vb.vbs
cscript //nologo c:\utils\vb.vbs
if exist c:\utils\vb.vbs del /q c:\utils\vb.vbs
endlocal
}
...which I load via my 4Start.btm (TCStart.btm) file as;
Code:
if exist c:\utils\vb.library library /r c:\utils\vb.library
I have also defined a function in my function.lst file as;
Code:
vb=%@execstr[vb %$]
...which I load via my 4Start.btm (TCStart.btm) file as;
Code:
if exist function.lst function /r function.lst
Now, I can use a single VBScript function, for example;
Code:
c:\users\jlc\utils>vb FormatCurrency(1000)
$1,000.00
..or
Code:
c:\users\jlc\utils>echo %@vb[FormatCurrency(1000)]
$1,000.00
Other examples;
Code:
vb FormatPercent(2/32)
6.25%
vb DateAdd("m", 1, "30-Nov-2017")
12/30/2017
vb MonthName(11)
November
vb MonthName(11, True)
Nov
vb DateDiff("d", "12/25/1955", Now) / 365.25
61.9329226557153
Joe