LowKey Posted November 21, 2009 Share Posted November 21, 2009 I don't ned help connecting or anything. I simply need to know how to make the edit control update only when needed, and new data on new lines. If anyone can help, I'd be much appreciative. Thanks in advance, I know its such a hard goal lulz. ~T3CHM4G3~PROjECTS: Telnet Client Link to comment Share on other sites More sharing options...
BrettF Posted November 21, 2009 Share Posted November 21, 2009 What do you have so far? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
LowKey Posted November 25, 2009 Author Share Posted November 25, 2009 What do you have so far? I know the answer is probably right in front of me, but I'm just kinda overloaded mentally and overlooking it. Teh Code: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: MaD SWeeNeY Script Function: Quick and dirty telnet client for the added enjoyment of MUDding, dubbed LMUD Notes: Don't mind the erratic and unorthodox comments, I'm a strange one. #ce ---------------------------------------------------------------------------- ; Script Start #include <GUIConstantsEx.au3> #include <EditConstants.au3> $defaultAddy = "abacus.bham.ac.uk" $defaultPort = 4080 Global $connected = 0 Global $doOnce = 0 Global $fp = 0 #cs; bee-tee-dub, keep this, cos it works. Remove in final product. Just in case, y'know? $host = InputBox( "Host", "Input host address:" ) ;Host to connect to $port = InputBox( "Port", "Input port number:" ) ;The port TCPStartup() ;start the TCP services $fp = TCPConnect( TCPNameToIP( $host ), $port ) ;start the connection If $fp = -1 Then MsgBox( 0, "", "error... " & $host ) ;If it wont connect, let me know -- Exit ;-- and quit EndIf While 1 ;Start an infinite loop, not permanent MsgBox( 0, "Telnet", TCPRecv( $fp, 65535 ) ) ;Receive data from the host WEnd ;End loop, MoFo!! #ce ;; ----------------------> Well, seems like the script works! w00t! <-------------------------- $main = GUICreate( "LMUD", @desktopwidth, @desktopheight - 75, 0, 0 ) ;Lets make a GUI, shall we? GUISetState( @SW_SHOW ) ;Show me the GUI GUISetBkColor( 0x000000 ) $fileMenu = GUICtrlCreateMenu( "&File" ) ;And some menus, make it look all legit like. $fileConnect = GUICtrlCreateMenuItem( "&Connect...", $fileMenu ) GUICtrlCreateMenu( "&Options" ) ;More menus! Do ;Do. (self explanatory) $msg = GUIGetMsg() ;This. (check for CLOSE ME msg from GUI) If $msg = $fileConnect Then ConnectGUI() EndIf If $connected = 1 Then TCPStartup() ;start the TCP services Global $fp = TCPConnect( TCPNameToIP( $host ), $port ) ;start the connection If $fp = -1 Then MsgBox( 0, "", "error... " & $host ) ;If it wont connect, let me know -- Exit ;-- and quit EndIf ConnectedTab() EndIf Until $msg = $GUI_EVENT_CLOSE ;Until this happens. (close GUI upon receiving CLOSE ME msg from GUI) Func ConnectGUI() $connectGUI = GUICreate( "Connect", 300, 100, 200, 100, -1, -1, $main) GUISetState( @SW_SHOW ) GUISetBkColor( 0x000000 ) GUICtrlCreateLabel( "Host:", 10, 10 ) GUICtrlSetColor( -1, 0x0000FF ) GUICtrlCreateLabel( "Port:", 10, 40 ) GUICtrlSetColor( -1, 0x0000FF ) $hostEdit = GUICtrlCreateInput( $defaultAddy, 70, 10, 150 ) $portEdit = GUICtrlCreateInput( $defaultPort, 70, 40 ) $connectButton = GUICtrlCreateButton( "Connect!", 10, 80 ) GUICtrlSetState( $connectButton, $GUI_DEFBUTTON ) Global $connected = 1 Do $connectMsg = GUIGetMsg() If $connectMsg = $connectButton Then Global $host = GUICtrlRead( $hostEdit ) Global $port = GUICtrlRead( $portEdit ) Global $connectMsg = $GUI_EVENT_CLOSE GUIDelete( $connectGUI ) EndIf Until $connectMsg = $GUI_EVENT_CLOSE EndFunc Func ConnectedTab() If $doOnce = 0 Then Global $connectEdit = GUICtrlCreateInput( "", 3, 683, @DesktopWidth - 7, 20 ) Global $connectDisplay = GUICtrlCreateEdit( "", 5, 51, @desktopwidth - 8, @desktopheight - 171, $ES_MULTILINE ) GUICtrlSetBkColor( $connectEdit, 0x000000 ) GUICtrlSetBkColor( $connectDisplay, 0x000000 ) GUICtrlSetColor( $connectEdit, 0xFFFFFF ) GUICtrlSetColor( $connectDisplay, 0xFFFFFF ) GUICtrlSetFont( $connectDisplay, 10, 400, 0, "Lucida Console" ) Global $doOnce = 1 EndIf $oldData = TCPRecv( $fp, 65535 ) $newData = TCPRecv( $fp, 65535 ) If $newData = $oldData Then GUICtrlSetData( $connectDisplay, $newData ) EndIf EndFunc ~T3CHM4G3~PROjECTS: Telnet Client Link to comment Share on other sites More sharing options...
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