Shoutbox

Send Text to window - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: Send Text to window (/showthread.php?tid=44988)

Send Text to window by Hilikus on 05-20-2005 at 12:00 AM

I've been thinking about ways to send messages from my plugin to the remote user but the only one i had managed to make work is the SendMessage with WM_CHAR solution
BUT

thats not good for me, if youre writting something and that funcion is called it will interrupt whatever you're writting and send it, and you also need to have it as foreground window, setwindowtoforeground and then again to background is too ugly for me

i know there must be a way using the IDispatch parameter in PLUGIN_PARAM, msgplus does it for ReceiveNotify, has anyone been able to do this using this way or any other way besides sending WM_CHAR ??

Thanks


RE: Send Text to window by RaceProUK on 05-20-2005 at 09:38 AM

Sending WM_CHAR messages? Sounds like you're writitng your own SendKeys. Mind you, it shouldn't be sending the message to your contact, even if you send a newline.
If you think it may be useful, look up Active Accessibility. You can use AccessibleObjectFromWindow on the HWND returned by the interface passed in the PLUGIN_PARAM (typecasted to IMessengerConversationWnd), then you can use the various other functions like AccessibleChildren to get the Input box, and set it's value.
It won't be simple, and will require testing and debugging. However, if you get it working, it'll be much better than SendKeys or WM_CHAR ;)


RE: Send Text to window by Hilikus on 05-21-2005 at 09:33 PM

well, im using c++. from what i know, yes, i was creating my own sendKeys

about your method, wouldnt it also interfere with what the user is typing?? i think any way of entering text through the GUI is also going to affect what the user is writting
if the user is writting something and the plugin triggers, it will cut off what you are typing, no?

what about calling whatever function messenger calls when you press enter??




RE: Send Text to window by RaceProUK on 05-22-2005 at 07:00 AM

If you get_accValue, append what you want to add, and set_accValue, that should just 'insert' into what the user is typing. The user can then carry on typing as before.

As for calling the function Messenger calls when you hit Enter: what exactly do you mean by this?


RE: Send Text to window by Hilikus on 05-22-2005 at 08:29 AM

no, thats exactly what i DONT want
i dont want my plugin to interfere with what the user is writting

by using sendmessage you're cut off when you're writting because of the ENTER key being simulated

and by the funcion i mean, what messenger does when you send a message, maybe you can use that function to send your text, i dont know, a crazy thought


RE: Send Text to window by RaceProUK on 05-22-2005 at 12:33 PM

SendMessage doesn't simulate the ENTER key unless you tell it to.
As for sending the text, use Active Accessibility to get the Send button, and make it do it's default action.


RE: Send Text to window by Hilikus on 05-22-2005 at 05:47 PM

mmm i know, but you NEED to simulate the enter key to send the message

i dont know how to explain it, look
lets say you're typing "hello how are you"
h e l l o  h o] at this moment, the contact tells you hey, and the script triggers! and replies (by using sendMessage) i'm busy...
the message your contact will get is your message with the plugin message appended which would be
"hello hoi'm busy..." and it IS going to send it, because of the ENTER key sendmessage, you HAVE TO simulate enter, otherwise the script message is just going to be sitting there. and my worry is that with your suggestion of Active accessibility the same thing is going to happen, cause you're suggesting to use set_accValue

do you know if this is going to happend, the thing is i dont think is very easy to do this so i dont want to break my head trying to do it and and the end it doesnt work


RE: Send Text to window by Dempsey on 05-22-2005 at 05:50 PM

couldnt you get the current text in the input, save it in a variable, send the automessage and then put the variable contents back into the input


RE: Send Text to window by RaceProUK on 05-22-2005 at 05:51 PM

Ahh, now I get what you mean!

The fix for that could be as follows:
- Get value from input box and store in temp variable
- Set value to automated reply
- Send
- Set value to what you stored in temp variable

Since this should happen very quickly, the user won't be interrupted while typing. In theory.

Edit: @Demps - Snap!


RE: Send Text to window by Hilikus on 05-22-2005 at 06:02 PM

k, im going to try that, but doesnt anybody know how msg plus does it???

that idispatch in plugin_param must have a purpose in it since you use it in receivenotify


saving the text and at the end loading it doesnt sound so bad, what i really dont like is that the window has to be active, and that changeactivewindow/write/changeactivetooriginalwindow i just dont like it, it looks bad and it bothers the user



RE: Send Text to window by RaceProUK on 05-22-2005 at 06:04 PM

quote:
Originally posted by raceprouk
look up Active Accessibility. You can use AccessibleObjectFromWindow on the HWND returned by the interface passed in the PLUGIN_PARAM (typecasted to IMessengerConversationWnd), then you can use the various other functions like AccessibleChildren to get the Input box, and set it's value

RE: Send Text to window by Dempsey on 05-22-2005 at 06:10 PM

quote:
Originally posted by Hilikus
k, im going to try that, but doesnt anybody know how msg plus does it???

quote:
Originally posted by Patchou
Anyway, for those wondering how Plus! gest the text of the chat window, it simply intercepts the EM_SETTEXT message before MSN Messenger replaces some of the text with emoticons. This is done by subclassing the creation of the windowless richedit controls (API subclassing).


quote:
Originally posted by Hilikus

saving the text and at the end loading it doesnt sound so bad, what i really dont like is that the window has to be active, and that changeactive/write/changeactivetooriginal i just dont like it, it looks bad and it bothers the user
When using Active Accesability AFAIK the window doesn't need focus