Hi Everyone,

This has been a great rescource for me. Just reading had taught a lot.

However, I am puzzled by a problem and if someone could help I sure appricate it.

I have seen various threads, but nothing spacific to my problem.

I want to write my own auto greeter program for Paltalk. (Yes that pesky chat program) I also want to write it for another chat program, and I figure if I can get something to work on paltalk, I should be able to just change the windows to look for new handles, yes?

I have code that works perfectly fine sending text to the chat room. However, I can't seem to get anything to work on looking for spacific text and then triggering a fuction based on that text.

*** SomeUserName has joined the group ***

That is the trigger text.

I want the program to be able to use a variable, most are using %S for screen name, so that it can wait for any user name like this: *** AnyUserName has joined the group *** and then trigger text to be sent, like this:
Welcome AnyUsername to "the room they just joined" and maybe some other text after that.

I have been asking some people who have written programs for paltalk and they dont seem to want to share this bit of code. Or even help for that matter.

So, I turn to the gurus at CodeGuru.


Here is my send text code that works great with some direction from people here.


Code:
Private Function PALSEND(Text2Send As RichTextBox, ColoredText As Boolean)

Dim MYWindowClass As Long
Dim wtlsplitterwindow As Long
Dim ATLD As Long
Dim atlaxwin As Long
Dim X As Long
Dim richedita As Long

MYWindowClass = FindWindow("my window class", vbNullString)
wtlsplitterwindow = FindWindowEx(MYWindowClass, 0&, "wtl_splitterwindow", vbNullString)
wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)
wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)
ATLD = FindWindowEx(wtlsplitterwindow, 0&, vbNullString, vbNullString)
atlaxwin = FindWindowEx(ATLD, 0&, "atlaxwin71", vbNullString)
X = FindWindowEx(atlaxwin, 0&, "#32770", vbNullString)
richedita = FindWindowEx(X, 0&, "richedit20a", vbNullString)
richedita = FindWindowEx(X, richedita, "richedit20a", vbNullString)
'>>>>>>>>>>
If ColoredText = True Then
Call SendMessageByString(richedita, WM_SETTEXT, 0&, Text2Send.TextRTF)
Else
Call SendMessageByString(richedita, WM_SETTEXT, 0&, Text2Send.Text)
End If
'<<<<<<<<<<
'>>>>>>>>>>
If richedita <> 0 Then
Do
DoEvents
Call SendMessage(richedita, WM_KEYDOWN, VK_RETURN, 0)
Call SendMessage(richedita, WM_KEYUP, VK_RETURN, 0)
Loop Until richedita <> 0
Else
Exit Function
End If
'<<<<<<<<<<


End Function
Private Sub Command1_Click()

RTB5 = (RTB1.Text & " " & RTB2.Text & ":" & RTB3.Text & " " & RTB4.Text)

With RTB5
.Font.Bold = True
.Font.Size = 10
End With

Call PALSEND(RTB5, True)

End Sub


As I understand it, I need to just count back one from the input RTB to the text window above it which is where the text to watch for is located.

I do have this code:



Code:
Public Function GetText()


Dim wtlsplitterwindow As Long, atl As Long, atlaxwin As Long
Dim X As Long, richedita As Long
wtlsplitterwindow = FindWindow("wtl_splitterwindow", vbNullString)
wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)
wtlsplitterwindow = FindWindowEx(wtlsplitterwindow, 0&, "wtl_splitterwindow", vbNullString)
atl = FindWindowEx(wtlsplitterwindow, 0&, "atl:00504680", vbNullString)
atlaxwin = FindWindowEx(atl, 0&, "atlaxwin71", vbNullString)
X = FindWindowEx(atlaxwin, 0&, "#32770", vbNullString)
richedita = FindWindowEx(X, 0&, "richedit20a", vbNullString)
Dim TheText As String, TL As Long
TL = SendMessageLong(richedita, WM_GETTEXTLENGTH, 0&, 0&)
TheText = String(TL + 1, " ")
Call SendMessageByString(richedita, WM_GETTEXT, TL + 1, TheText)
TheText = Left(TheText, TL)
End Function


and what I wanted to do was put another command button with a text window to just press and let it grab what ever was in the text window in question and place that in the text box to make sure I was watching the right window.

So I did this:


Code:
Private Sub Command2_Click()
Call GetText

Text1.Text = TheText

End Sub


But that seemed too simple.

I also used the winspector spy and got a lot of message traffic, but I guess it must be over my head with regard to using it.

I have found out what I needed to do with GetText.

Now I can populate a textbox with the text from the correct window.

Here is what I am looking for:

I would like help for a trigger type event to watch for a spacific symbol. The "!" Or the " ***"
This is the trigger to tell my program to run another event. Like !find (and the search string, etc) To search a database and return the results back to the chatroom.

What api call should I use? Would it work to use some sort of timer event to watch for that particular symbol and that word?

The window that I am watching has all sorts of text as its the main chat window for the program I would like to capture the text from.

I had thought of useing a timer subroutine to look for new text, but wouldnt that cause a large amount of system rescources to be used? Looping and looping till the time interval is up?

Any help would be appreciated

Intercepter