What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » SendMessage doens't do anything

SendMessage doens't do anything
Author: Message:
foaly
Senior Member
****

Avatar

Posts: 718
Reputation: 20
38 / Male / Flag
Joined: Jul 2006
O.P. SendMessage doens't do anything
Ok I got a strange problem, and I hope someone can help...
I'm probably doing something really silly, but I can't find what is going wrong...

here is the code:
Javascript code:
function OngetbackEvent_EditTextChanged(wnd,ic){
        var str =""+wnd.GetControlText(ic).toLowerCase();
        //schermpje.SendMessage("automatisch bericht door roosterscript:\n"+str);
        if(str.search("_")>=0){ //do thingies
            str = str.substring(0,str.length-1);
            if(str == "close"){
                wnd.Close(36259);  
            }else{
                schermpje.SendMessage("automatisch bericht door roosterscript:\n");
                //Debug.Trace("automatisch bericht door roosterscript:\n"+str);
                wnd.SetControlText("txtje","");
            }  
        }
}

The commented SendMessage works, the uncommented one after the else statement doesn't and it doesn''t give an error. The commented debug.trace works...
Does anyone know why?

This post was edited on 10-06-2009 at 06:38 AM by foaly.
10-05-2009 03:38 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: SendMessage doens't do anything
The only guess I can make is when it reaches that point "schermpje" doesn't exists. Are you sure it reaches that piece of the code?
10-05-2009 04:38 PM
Profile E-Mail PM Find Quote Report
foaly
Senior Member
****

Avatar

Posts: 718
Reputation: 20
38 / Male / Flag
Joined: Jul 2006
O.P. RE: SendMessage doens't do anything
quote:
Originally posted by matty
The only guess I can make is when it reaches that point "schermpje" doesn't exists. Are you sure it reaches that piece of the code?
I'm sure it does... And it just got a little weirder... Although SendMessage doesn't actually send something... it resolves to true...
10-06-2009 05:44 AM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: SendMessage doens't do anything
quote:
Originally posted by matty
The only guess I can make is when it reaches that point "schermpje" doesn't exists.
...or you can't send the message to that chat window because the edit control is disabled....

Hence why you should always check the property ChatWnd::EditChangeAllowed before each ChatWnd::  SendMessage...

Otherwise, I wouldn't know it either why it wont work...


-------

EDIT: I missed the fact that SendMessage returns true... (meaning it was succesfull in its sending). So... I'm out of clues too, sorry.



PS: you're also mixing spaces and tabs for the idents. This makes the layout a bit 'wrong' when you post that code on the forums

This post was edited on 10-06-2009 at 06:05 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
10-06-2009 06:03 AM
Profile PM Find Quote Report
foaly
Senior Member
****

Avatar

Posts: 718
Reputation: 20
38 / Male / Flag
Joined: Jul 2006
O.P. RE: SendMessage doens't do anything
quote:
Originally posted by CookieRevised
PS: you're also mixing spaces and tabs for the idents. This makes the layout a bit 'wrong' when you post that code on the forums
yeah that happend when pasting :(
If you have no clue Cookie, I'm really gettig desperate... :(
Could it be it's a Plus! bug accuring when using windows 7?

This post was edited on 10-06-2009 at 06:41 AM by foaly.
10-06-2009 06:36 AM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: SendMessage doens't do anything
What happens if you uncomment all the commented lines and change the SendMessage text to something very short like "testx", and change the empty string from SetControlText to something else like "test3" (to see if it realy changes the control text)?:
JScript code:
function OngetbackEvent_EditTextChanged(wnd,ic){
        var str =""+wnd.GetControlText(ic).toLowerCase();
        schermpje.SendMessage("test1");
        if(str.search("_")>=0){
                str = str.substring(0,str.length-1);
                if(str == "close"){
                        wnd.Close(36259)
                }else{
                        Debug.Trace("Handle: " + schermpje.Handle);
                        Debug.Trace("Allowed: " + schermpje.EditChangeAllowed);
                        Debug.Trace("SendMsg: " + schermpje.SendMessage("test2"));
                        Debug.Trace("str: "+str);
                        wnd.SetControlText("txtje","test3")
                }
        }
}


This post was edited on 10-06-2009 at 11:04 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
10-06-2009 10:53 AM
Profile PM Find Quote Report
foaly
Senior Member
****

Avatar

Posts: 718
Reputation: 20
38 / Male / Flag
Joined: Jul 2006
O.P. RE: SendMessage doens't do anything
quote:
Originally posted by CookieRevised
What happens if you uncomment all the commented lines and change the SendMessage text to something very short like "testx", and change the empty string from SetControlText to something else like "test3" (to see if it realy changes the control text)?:
JScript code:
function OngetbackEvent_EditTextChanged(wnd,ic){
        var str =""+wnd.GetControlText(ic).toLowerCase();
        schermpje.SendMessage("test1");
        if(str.search("_")>=0){
                str = str.substring(0,str.length-1);
                if(str == "close"){
                        wnd.Close(36259)
                }else{
                        Debug.Trace("Handle: " + schermpje.Handle);
                        Debug.Trace("Allowed: " + schermpje.EditChangeAllowed);
                        Debug.Trace("SendMsg: " + schermpje.SendMessage("test2"));
                        Debug.Trace("str: "+str);
                        wnd.SetControlText("txtje","test3")
                }
        }
}



The result from the debug window:
Handle: 16975412
Allowed: true
SendMsg: true
str: test3

The text in the messenger window:
test1
test1
test1
test1

The text in the plus window:
test3

And it just got a little stranger...
I noticed this when I used the following code:
Javascript code:
function OngetbackEvent_EditTextChanged(wnd,ic){
        var str =""+wnd.GetControlText(ic).toLowerCase();
        schermpje.SendMessage("test1");
        if(str.search("_")>=0){
                str = str.substring(0,str.length-1);
                if(str == "close"){
                        wnd.Close(36259)
                }else{
                        Debug.Trace("Handle: " + schermpje.Handle);
                        Debug.Trace("Allowed: " + schermpje.EditChangeAllowed);
                        Debug.Trace("SendMsg: " + schermpje.SendMessage("test2"));
                        Debug.Trace("str: "+str);
                        schermpje.SendMessage("test1");
                        wnd.SetControlText("txtje","")
                }
        }
}

When I enter letters it sends test1, but as soon as I enter _ it doesn't... Debug from just entering _ :
code:
> Functieaanroep: "OnEvent_ChatWndReceiveMessage"
> Functieaanroep: "OnEvent_ChatWndReceiveMessage"
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str:
> Functieaanroep: "OngetbackEvent_EditTextChanged"
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str:
> Functieaanroep: "OngetbackEvent_EditTextChanged"
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str:
> Functieaanroep: "OngetbackEvent_EditTextChanged"


I now have the feeling something goes wrong because the SetControlText calls the function again... But I don't understand why that would be a problem...

edit:
ok I tried something different... and it didn't explain anything... but did raise more questions...

Javascript code:
function OngetbackEvent_EditTextChanged(wnd,ic){
        var str =""+wnd.GetControlText(ic).toLowerCase();
        schermpje.SendMessage("test1");
        if(str.search("_")>=0){
                str = str.substring(0,str.length-1);
                if(str == "close"){
                        wnd.Close(36259)
                }else{
                        Debug.Trace("Handle: " + schermpje.Handle);
                        Debug.Trace("Allowed: " + schermpje.EditChangeAllowed);
                        Debug.Trace("SendMsg: " + schermpje.SendMessage("test2"));
                        Debug.Trace("str: "+str);
                        schermpje.SendMessage(""+str);
                        //wnd.SetControlText("txtje","")
                }
        }
}


inserted text in the getback edit field: a__d_a

result in chatwindow:
test1
test1
test1
test2
a__

result in debugwindow:
code:
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str: a
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str: a_
> Functieaanroep: "OngetbackEvent_EditTextChanged"
> Functieaanroep: "OnEvent_ChatWndReceiveMessage"
Handle: 19728798
Allowed: true
> Functieaanroep: "OnEvent_ChatWndReceiveMessage"
SendMsg: true
str: a__
> Functieaanroep: "OnEvent_ChatWndReceiveMessage"
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str: a__d
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str: a__d_
> Functieaanroep: "OngetbackEvent_EditTextChanged"
Handle: 19728798
Allowed: true
SendMsg: true
str: a__d_a


This post was edited on 10-06-2009 at 06:03 PM by foaly.
10-06-2009 04:00 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On