| gclib 1.34.15 Communications API for Galil controllers and PLCs |

Commands_Example.vb
1 ''' <summary>
2 ''' Demonstrates various uses of GCommand() And basic controller queries.
3 ''' </summary>
4 ''' <remarks>The first argument should be the IP Address of a Galil controller.</remarks>
5 Module Commands_Example
6
7 ''' <summary>
8 ''' Main function for the commands example.
9 ''' </summary>
10 ''' <returns>The success status Or error code of the function.</returns>
11 ''' <remarks>The first argument should be the IP Address of a Galil controller.</remarks>
12 Function Main() As Integer
13 Dim rc As Integer = Examples.GALIL_EXAMPLE_OK
14 Dim gclib As Gclib = New Gclib()
15 Dim args() As String = Environment.GetCommandLineArgs()
16 Try
17 If args.Count() <> 2 Then
18 Console.WriteLine("Incorrect number of arguments provided")
19 Console.WriteLine("Usage: commands_example.exe <ADDRESS>")
20
21 Console.Write(vbCrLf + "Press any key to close the example.")
22 Console.ReadKey()
23 Return Examples.GALIL_EXAMPLE_ERROR
24 End If
25
26 Dim address As String = args(1)
27
28 gclib.GOpen(address)
29
30 rc = Examples.Commands(gclib)
31 Catch ex As Exception
32 Examples.PrintError(gclib, ex)
33 rc = Examples.GALIL_EXAMPLE_ERROR
34 Finally
35 gclib.GClose()
36 End Try
37
38 Console.Write(vbCrLf + "Press any key to close the example.")
39 Console.ReadKey()
40
41 Return rc
42 End Function
43
44 End Module