Klovis Posted July 20, 2011 Posted July 20, 2011 So I want to click this button once and after I click it the first time it will receive new properties, the first time It connects to the IP you put in input1 then the second time you press it, it will send what is in input1. But I failed and I'm lost. #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $IP, $TCPConnect, $i = 0 TCPStartup() $Form1 = GUICreate("Client", 108, 23, 373, 441, -1, $WS_EX_TOPMOST) $Input1 = GUICtrlCreateInput("0.0.0.0", 0, 0, 66, 21) $Button1 = GUICtrlCreateButton("Connect", 72, 0, 35, 21) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If $i = 0 Then $IP = GUICtrlRead($Input1) $TCPConnect = TCPConnect($IP, 5000) GUICtrlSetData($Button1, "Send") EndIf $i = 1 If $i = 1 Then TCPSend($TCPConnect, GUICtrlRead($Input1)) GUICtrlSetData($Input1, "") EndIf EndSwitch WEndclientinput.au3
smartee Posted July 20, 2011 Posted July 20, 2011 Try this Case $Button1 If $i = 0 Then $IP = GUICtrlRead($Input1) $TCPConnect = TCPConnect($IP, 5000) GUICtrlSetData($Button1, "Send") $i = 1 Else TCPSend($TCPConnect, GUICtrlRead($Input1)) GUICtrlSetData($Input1, "") EndIf
Klovis Posted July 20, 2011 Author Posted July 20, 2011 Try this Case $Button1 If $i = 0 Then $IP = GUICtrlRead($Input1) $TCPConnect = TCPConnect($IP, 5000) GUICtrlSetData($Button1, "Send") $i = 1 Else TCPSend($TCPConnect, GUICtrlRead($Input1)) GUICtrlSetData($Input1, "") EndIf It's always the else I forget. Thanks Cartmen ^^
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now