API example: Showing thicknesses within a range

You can use any standard function to interact with the user, such as VBScript's InputBox() function. This example displays the Thickness diagnostic with thicknesses between two user-specified values.

This script can be run either as a command or as a macro. If parameters were not supplied on the command line when the script was run, you will be prompted to input parameters. The bold section below implements the user input prompts after checking for two command line argument values.

'%RunPerInstance
'@
'@ DESCRIPTION
'@ 
'@
'@ SYNTAX
'@ ShowThicknessInRange [Min] [Max]
'@
'@ PARAMETERS
'@ Min   Minimum Thickness value
'@ Max   Maximum Thickness value
'@
'@ DEPENDENCIES/LIMITATIONS
'@ none
'@
'@ History
'@ Created DRA 9/8/2006
'@@ 
Option Explicit
SetLocale("en-us")
Dim SynergyGetter, Synergy
On Error Resume Next
Set SynergyGetter = GetObject(CreateObject("WScript.Shell").ExpandEnvironmentStrings("%SAInstance%"))
On Error GoTo 0
If (Not IsEmpty(SynergyGetter)) Then
  Set Synergy = SynergyGetter.GetSASynergy
Else
  Set Synergy = CreateObject("synergy.Synergy")
End If
Synergy.SetUnits "METRIC"

Dim DiagnosisManager
Dim MinimumThickness, MaximumThickness
Dim Args

Set Args = Wscript.Arguments
If Args.Count <> 2 Then
        MinimumThickness = InputBox("Enter Minimum Thickness")
        MaximumThickness = InputBox("Enter Maximum Thickness")
Else
        MinimumThickness = Args(0)
        MaximumThickness = Args(1)
End If

Set DiagnosisManager = Synergy.DiagnosisManager()
DiagnosisManager.ShowThickness MinimumThickness, MaximumThickness, False

MsgBox "Script Complete"
WScript.Quit