Automation

Some features of NetWorx are accessible via automation, also known as OLE automation. You can manipulate the Speed Meter component using any programming language supporting this technology, including Windows Script Host.

There are several methods that can be called to control the Speed Meter:

Prototype Description
HRESULT _stdcall Start(void) Brings up the Speed Meter and starts recording data.
HRESULT _stdcall Stop(void) Stops recording data.
HRESULT _stdcall SaveToFile([in] BSTR FileName) Saves the displayed result to a file.
HRESULT _stdcall Text([out, retval] BSTR * Value) Returns the displayed result as a string.
HRESULT _stdcall Reset(void) Resets the Speed Meter.

Example.vbs: All the methods called from a VB script.

'Make up an instance
set SpeedMeter = Wscript.CreateObject("NetWorx.SpeedMeter")

'Start the meter
SpeedMeter.Start

'Wait five seconds
WScript.Sleep 5000

'Stop the meter
SpeedMeter.Stop

'Retrieve result
Result = SpeedMeter.Text
WScript.Echo "Result: " & Result

'Save it to file
SpeedMeter.SaveToFile "c:\test.txt"

'Free memory
set SpeedMeter=nothing

Note: If you are using the portable build, this functionality is not available because NetWorx has to be registered as an automation server during installation.