Hi all i use this code to check for a certain word if it posted in room and if a certain room is posted in room i post back a customed massage. The current code sends infinite massages when a specific word is posted. Could any one tell me what i am doing wrong to just want post back one time instead of infinit times.Thanks
- Code: Select all
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 10
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
[B]Call LastChatLine[/B]
Call usertext
Call username
Text2 = Replace(Text2, Chr(10), "")
End Sub
modeule code
- Code: Select all
Option Explicit
....
....
....
Function LastChatLine()
On Error Resume Next
Dim LastLine
Dim lastlen
Dim TheChatText As String
Dim TheChars As String
Dim TheChar As String
Dim FindChar
Dim ChatText As String
ChatText$ = GetChatText
For FindChar = 1 To Len(ChatText$)
TheChar$ = Mid(ChatText$, FindChar, 1)
TheChars$ = TheChars$ & TheChar$
If TheChar$ = Chr(13) Then
TheChatText$ = Mid(TheChars$, 1, Len(TheChars$) - 1)
Form1.RichTextBox1.Text = TheChatText$
'i added this line
Form1.Text4.Text = TheChatText$
Dim txt
txt = TheChatText$
If InStr(1, txt, "david") > 0 Then
Form1.Text4.Text = Replace(txt, "david", "some one mentioned u name")
'form1.Timer1.Enabled = False
Call Send("send this massage")===> this is called infinite times!!
txt = ""
'form1.Timer1.Enabled = True
End If
TheChars$ = ""
End If
Next FindChar
lastlen = Val(FindChar) - Len(TheChars$)
LastLine = Mid(ChatText$, lastlen, Len(TheChars$))
LastChatLine = LastLine
End Function



