vbscript

you can write with vbscript in beas-script

beas use the wsh Object MSScriptControl.ScriptControl

the vbscript-object is only visible in the current window from first call to close-window

 

you can define functions with

[vbs]

// your code

[/vbs]

or in one line

vbscript=your code

or

vbs=your code

and can execute and get the result with

messagebox=<vbs.yourcode>

 

Examples: Hexadecimal

messagebox=<vbs.hex(255)>

return "FF"

 

Example: input Decimal in ll_dec and insert this value in the vbscript

Use [] for placeholder in <> - Placeholder

input=Decimal -> Hex=ll_dec

messagebox=<vbs.hex([ll_dec])>

 

declare function

[vbs]

function dec2hex (s)

dec2hex=hex(s)

end function

[/vbs]

messagebox=<vbs.dec2hex(255)>

 

Example: set string about all items in the itemlist

// set vbscript-Variable
vbs.ivar=""
// beas-Script-Loop
for ll_loop=1 to <dw_1.rowcount>
  // add beas-Script-Variable to ivar-Variable
  vbs=ivar=ivar+"<dw_1.item.itemcode:[ll_loop].value>   "
next
// display the 
meldung=<vbs.ivar>

 

Example: Get all CPU's and the Speed of CPU

[vbs]
function rtnProcessor ()
ls_info=""
strComputer = "."
Set objWMIService =   GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem in colItems
 ls_info=ls_inf+objItem.Name+" (Speed: "+cstr(objItem.MaxClockSpeed )+" MHz)  "+vbCrLf
Next
 
rtnProcessor=ls_info
end Function
[/vbs]
meldung=<vbs.rtnProcessor()>

 

Examppe: Get IP-Address

[vbs]

function getinfo ()

set oAdapters =  GetObject("winmgmts:").execquery(   "SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

s=""

For Each oAdapter In oAdapters

  s = s +  "IP"+join(oAdapter.IPAddress)+"<IP>"+vbCrLf

next

getinfo=s

End function

[/vbs]

message=<vbs.getinfo()>

 

More Info about VBScript: see Microsoft.msdn