The users can reuse VBScript in SALAD through VBSHandler.(for JavaScript, JSHandler)

  • registered COM object that is MSScriptControl.ScriptControl
  • session what's in 32bit mode

There are VBScript files.(For example colony.vbs)
Put the files in one directory wherever you like.(for example "c:\temp\vbs")
Load and use them.

The users can new them, call their methods so that USOClasses and Functions can collaborate with VBScript or JavaScript.

# create script handler
$b = new VBSHandler;
# initialize
$b = $b.Initialize("C:\temp\vbs");
# new colony class
$classname = "colony";
$colony = $b.New($classname);

# and else, whatever you like

# initialize colony(this is a method that Colony class has in vbs)
# check colony instance
# send 100 days for colony(NextDay is a method that Colony class has in vbs)
0..99 | %{$colony.NextDay()};
# check colony instance
# check colony workers
$colony.workers | Group-Object alive;

about Colony.vbs
  • has Queen and Workers.
  • gets tomorrow by NextDay method.
  • lives 50000 days.
  • sometimes bear a Worker, and Worker belongs to Colony.
  • sometimes dies.
  • create a Colony and give it some days.

The operations in VBS are like following.
Set c = New Colony
Call c.Initialize()
Call c.NextDay()
MsgBox (Cstr(c.age))

Last edited Mar 2, 2013 at 3:12 PM by Tom__S, version 14


No comments yet.