#include #include #include #include #include #include #include "EzMySql.au3" #include Local $sMySqlStatement = "" #Region ### START Koda GUI section ### Form=C:\Users\csawyer\Desktop\Camera Test\Form1.kxf $Form1 = GUICreate("HighSpeed =======>>Camera", 1211, 561, 198, 129, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP)) $Group1 = GUICtrlCreateGroup("Job Details", 984, 8, 217, 393) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH) $Label2 = GUICtrlCreateLabel("Client ID:", 1024, 40, 79, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH) $Label3 = GUICtrlCreateLabel("Failed Reads:", 992, 80, 115, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKHCENTER+$GUI_DOCKWIDTH) $Label4 = GUICtrlCreateLabel("Current Tray:", 1000, 120, 108, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUICtrlSetResizing(-1, $GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKWIDTH) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label1 = GUICtrlCreateLabel("58695326589741235896523147852132", 256, 408, 622, 41) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") $Label6 = GUICtrlCreateLabel("58695326589741235896523147852132", 264, 459, 612, 28) GUICtrlSetFont(-1, 24, 400, 0, "3 of 9 Barcode") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### TCPStartup () $Host = TCPNameToIP ( "192.168.2.2" ) ;$Host = TCPNameToIP ( "192.168.0.254" ) $Conection = TCPConnect ( $Host, 23 ) ;<<<<<<<<<< change the port ;If @error Then Exit If @error Then ; The server is probably offline/port is not opened on the server. Local $iError = @error MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Could not connect, Error code: " & $iError) ;Return False Else ;MsgBox($MB_SYSTEMMODAL, "", "Connection successful") EndIf If Not _EzMySql_Startup() Then MsgBox(0, "Error Starting MySql", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg()) Exit EndIf $Pass = "mysql" If Not _EzMySql_Open("", "root", $Pass, "", "3306") Then MsgBox(0, "Error opening Database", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg()) Exit EndIf If Not _EzMySql_Exec("CREATE DATABASE IF NOT EXISTS EzMySqlTest") Then MsgBox(0, "Error opening Database", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg()) Exit EndIf If Not _EzMySql_SelectDB("ezmysqltest") Then MsgBox(0, "Error setting Database to use", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg()) Exit EndIf While 1 CaptureTelnet() $nMsg = GUIGetMsg() Switch $nMsg _ Case $GUI_EVENT_CLOSE TCPCloseSocket($Conection) ; Close the socket. TCPShutdown() ; Close the TCP service. Exit ;Case $Button1 ;LoadImage() ;Case $Button2 ;CaptureTelnet() EndSwitch WEnd Func CaptureTelnet() ;GUICtrlSetData($List1, "test|test 2") $recv = TCPRecv ( $Conection,2048 ) If $recv <> "" Then ;$text = GUICtrlRead ( $Edit ) ;GUICtrlSetData ($List1,$recv ) GUICtrlSetData($Label1, $recv) GUICtrlSetData($Label6, $recv) $sMySqlStatement &= "INSERT INTO readinfo (readid) VALUES ('" & $recv & "')" If Not _EzMySql_Exec($sMySqlStatement) Then MsgBox(0, "Error inserting data to Table", "Error: "& @error & @CR & "Error string: " & _EzMySql_ErrMsg()) Exit EndIf EndIf EndFunc