| gclib 1.32.6 Communications API for Galil controllers and PLCs |

Record_Position_Example.vb
1 Module Record_Position_Example
2 Function Main() As Integer
3 Dim rc As Integer = Examples.GALIL_EXAMPLE_OK
4 Dim gclib As Gclib = New Gclib()
5 Dim args() As String = Environment.GetCommandLineArgs()
6 Try
7 If args.Count <> 4 Then
8 Console.WriteLine("Incorrect number of arguments provided")
9 Console.WriteLine("Usage: record_position_example.exe <ADDRESS> <FILE A> <FILE B>")
10
11 Console.Write(vbCrLf + "Press any key to close the example.")
12 Console.ReadKey()
13 Return Examples.GALIL_EXAMPLE_ERROR
14 End If
15
16 Dim address As String = args(1) 'Retrieve address from command line
17 Dim fileA As String = args(2) 'Retrieve filepath from command line
18 Dim fileB As String = args(3) 'Retrieve filepath from command line
19
20 gclib.GOpen(address) 'Open a connection at the provided address
21
22 rc = Examples.Record_Position(gclib, fileA, fileB) 'Begin Recording Position
23 Catch ex As Exception
24 Examples.PrintError(gclib, ex)
25 rc = Examples.GALIL_EXAMPLE_ERROR
26 Finally
27 gclib.GClose()
28 End Try
29
30 Console.Write(vbCrLf + "Press any key to close the example.")
31 Console.ReadKey()
32
33 Return rc
34 End Function
35 End Module