'This VBScript code is used to control the VISIO object
'in the scripting example discussed in the file VISIO2.MCD.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Sub VisioPageObjEvent_Start()
  REM TODO: Add your code here
End Sub

Sub VisioPageObjEvent_Exec(Inputs,Outputs)

  'Variable declarations
  Dim BatteryObj, ResistorObj, CapacitorObj
  Dim voltage, resistance, capacitance

  'Define object variables
  Set BatteryObj = Shapes.Item("Battery")
  Set ResistorObj = Shapes.Item("Resistor")
  Set CapacitorObj = Shapes.Item("Capacitor")

  'Get component values from the input ports
  voltage = Inputs(0).Value(0,0)
  resistance = Inputs(1).Value(0,0)
  capacitance = Inputs(2).Value(0,0)

  'Modify component text labels
  BatteryObj.Text = voltage & " V"
  ResistorObj.Text = resistance & " Ohm"
  CapacitorObj.Text = capacitance & " pF"

  'Output stuff here, if appropriate.
  'Outputs(0).Value=1

End Sub

Sub VisioPageObjEvent_Stop()
  REM TODO: Add your code here
End Sub