quote:
Originally posted by bigbob85
All this talk about ChatWnd is making my head spin, but I think I got a good idea.
I dont think its SendMessage that draws the windows focus, its the OpenChat. So if I dont do that, and just use the ChatWnd Iterator and then see if the contact I want to send it to is in the chat (and there is only 1 person in the chat) to then send the message. Thus, avoiding the OpenChat.
That will
only work if there is already a chat with that contact. If there isn't a chat open with the contact,
SendMessage (and your script) will fail and produce an error.
Also note that in order to
SendMessage to work, the chat window
must be the active window and in focus! If it is not,
SendMessage will bring the chat window automatically in front too (and restore the previous window when it is done sending). This is how Plus! works.
Also, no matter what you do, do not forget to check with
EditChangeAllowed if you actually can send a message to the chat window. This is mandatory! See scripting documentation
MsgPlus:: SendMessage.
PS: if the initial goal from the beginning was to only send a message when there is an existing chat window, then in the future please specify such important details. Many stuff depends on what one wants to do exactly, and if one doesn't provide such details, decent help can not be given.