Slythfox Posted October 27, 2006 Posted October 27, 2006 (edited) Beta version: 3.2.1.11 I have a simple script that connects to irc and gives its output in an edit text area. I was trying to make it autoscroll to the bottom of the edit area using _GUICtrlEditLineScroll and including GuiEdit.au3. After I had done this, irc stuff would stop. I was logged in to the irc channel myself, and it say the user had connected, then quit, because of a "Broken Pipe" I'm not sure what the problem is... But it seems to me that there is some sort of interference with GUIEdit.au3 and TCP... it's really weird. It could even be a problem with my code, but it doesn't make sense that it does, because if I take out the GUIEdit.au3 include, it connects flawlessly. EDIT: The first time I ran into this problem, I tried repeating it a few times, then removing it, and what I explained above seemed to be the issue. However, I was messing with it more just now, it works. However, at one point it stopped working again. Weird. I'll edit this when I can look into the issue more. Here's the script without GUIedit.au3 and _GUICtrlEditLineScroll: expandcollapse popup#include <GUIConstants.au3> ; ---- Variables ---- ; -- IRC Variables ;Global $addr = "82.96.64.4";irc.freenode.net Global $addr = "irc.freenode.net" Global $port = "6667" Global $channel = "#TheSoftwareJedi" Global $nick = "foobot" ; -- App Variables Global $appname = "IRCBot" Global $trayiconpath = "" Opt("TCPTimeout",100);in ms ; -- GUI $gui = GuiCreate("IRCbot", 500, 520) $serveroutput = GUICtrlCreateEDIT("", 3, 25, 491, 470, -1, ) GuiSetState() TCPStartup() $ip = TCPNameToIP($addr) $sock = TCPConnect($ip, $port) If @error Then ReportError("Could not connect to " & $addr) Exit EndIf $a = GuiCtrlSetData($serveroutput, "Connected to " & $addr & "." & @CRLF) $loop = 0 While 1 ; If window should close. If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit EndIf $irc = TCPRecv($sock, 1024) If @error Then ReportError("Could not recieve data from " & $addr) Exit EndIf If NOT $irc = "" Then $prev = GuiCtrlRead($serveroutput) $b = GuiCtrlSetData($serveroutput, $prev & "" & $irc) EndIf If $loop = 1 Then IRC_Send("NICK " & $nick & @CRLF) IRC_Send("USER " & $nick & " irc.freenode.net irc.freenode.net IRCBot" & @CRLF) IRC_Send("JOIN " & $channel & @CRLF) EndIf $loop += 1 WEnd ; ---- Functions ---- Func IRC_Send($Msg) Global $sock TCPSend($sock, $Msg) EndFunc Func ReportError($Msg) GUICreate($appname & " Error", 260, 80) GuiSetIcon(@ScriptDir & "\" & $trayiconpath, 0) $Label = GuiCtrlCreateLabel($Msg, 10, 10, 240, 42) $OkayButton = GUICtrlCreateButton("OK", 90, 50, 72, 22) GUICtrlSetState(-1, $GUI_FOCUS) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then GUIDelete() ExitLoop ;Exit ElseIf $msg = $OkayButton Then GUIDelete() ExitLoop ;Exit EndIf WEnd GUIDelete() EndFunc Edited October 27, 2006 by Slythfox
GaryFrost Posted October 27, 2006 Posted October 27, 2006 Beta version: 3.2.1.11I have a simple script that connects to irc and gives its output in an edit text area. I was trying to make it autoscroll to the bottom of the edit area using _GUICtrlEditLineScroll and including GuiEdit.au3. After I had done this, irc stuff would stop. I was logged in to the irc channel myself, and it say the user had connected, then quit, because of a "Broken Pipe"I'm not sure what the problem is... But it seems to me that there is some sort of interference with GUIEdit.au3 and TCP... it's really weird. It could even be a problem with my code, but it doesn't make sense that it does, because if I take out the GUIEdit.au3 include, it connects flawlessly.I have to say I doubt that it's the GUIEdit.au3 include, me and others at one time were using it in a project for a tcp chat client/server project worked with no problems. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Valik Posted October 28, 2006 Posted October 28, 2006 You know, you really should use your brain on occasion before you make wild statements that two completely unrelated pieces of code are interfering with each other. The answer to your problem is really simple. Learn how the Not keyword works. Lastly, moving to support, the place this should have been posted in the first place.
Slythfox Posted October 28, 2006 Author Posted October 28, 2006 I was using my brain, but here's the thing: this issue occurred only when I added those two pieces of code, and when I removed them, it worked. So I could only assume that one or both of the lines I added were causing the issue. The issue was repeatable. Interestingly, I was playing with the two lines of code again, and I added them again and it worked... Now, the only times when I see that error is when I've opened the program, then quickly closed it before it could finish connecting. Perhaps that was what I was doing when I added those two lines in the first place (but I don't think so because In order for me to test to see if the _GUICtrlEditLineScroll function worked, I had to wait until the script had been connected.) I still don't see how Not in one of the if cases has to do with the problem. It is used to display the text received, and shouldn't interfere with the connection and receiving code. If the Not was causing an issue, the script wouldn't have outputted correctly like it had been doing, or would have generated an error, which it didn't. Are there any other possibilities?
GaryFrost Posted October 28, 2006 Posted October 28, 2006 with-out testing the script the following is in-valid use of NOT If NOT $irc = "" Then oÝ÷ ÚÚºÚ"µÍYÝ[Ó[ ÌÍÚÊH[ SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Slythfox Posted October 28, 2006 Author Posted October 28, 2006 (edited) That makes more sense. I had seem people use NOT before, so I assumed it does what <> does, especially when the autoit documents say "Logical NOT operation. e.g. NOT 1 (equals 0)" That example had confused me before, now I get it. Thanks. BTW, the script works the same with NOT and with <>. Edited October 28, 2006 by Slythfox
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