$WBRUN - execute external script

Availability
$WBRUN is available for use with all WBSP commands in scripting languages listed in Execute variable of WBSP.ssc file.

Syntax
$WBRUN{scriptfilename|Language|function(fnargs)}
$WBRUN[scriptfilename|Language|function(fnargs)]

Parameters
scriptfilename - full path and file name of the file where script code is stored
language - name of the scripting language used in script (e.g. JavaScript, VBScript, JScript, etc.)
function - name of the function that should be executed - fnargs are arguments required by the script function, not by the WBSP


Returns
Result returned by script function.

Example

[FormFields]
wb_command=R
wb_showlogo=F
<!--WB_BeginTemplate-->
<html>
<body>
File size for biblio.mdb: $wbrun[getfilesize.vbs|VBScript|getFSize("$wbcurrdir[]biblio.mdb")]
</body>
</html>

File getfilesize.vbs

Function getFSize(fname)
Dim fso
Dim fil
Set fso = CreateObject("Scripting.FileSystemObject")
set fil = fso.GetFile(fname)
sizebytes=fil.size
if sizebytes<1024 then getFSize=sizebytes & " bytes": exit function
if sizebytes<1024^2 then getFSize=formatnumber(sizebytes/1024,2) & " KB": exit function
getFSize=formatnumber(sizebytes/1024^2,2) & " MB"
end function

After running this example, the resulting page in web browser may look like this:

File size for biblio.mdb: 112,00 KB