Script

<< Click to Display Table of Contents >>

 

Script

In this exercise, let's create a script to change the simulators accessed using the configured TCP/IP port.

1.On the initial Screen, insert a Command Button.

2.Select the Scripts tab and create a new script on the Click event.

3.Insert the next code.

Set driver = Application.GetObject("Driver1")
Set port = Application.GetObject("Driver1.[IO.Ethernet.MainPort]")
'Set this Driver to Offline mode
driver.Write -1, 0, 0, 4, 0
'Change its TCP/IP port
If port.Value = 502 Then
  port.WriteEx 503
Else
  port.WriteEx 502
End If
'Set this Driver to Online mode
driver.Write -1, 0, 0, 4, 1

 

4.Execute the application and test this new functionality.

Was this page useful?