What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Help] My Problem...

[Help] My Problem...
Author: Message:
b0rna
New Member
*


Posts: 11
Joined: Jun 2006
O.P. Undecided  [Help] My Problem...
Hi,

i will try to be as through as i can with this so you can understand it easier.

im not very advanced in programming and thus i am having this problem.

Here is a function that i have. the variables inside this function hold a Cache of data. A string cache at which every time the timer of 100ms is called empties 1000 charactesr of that cache.

now i can use debug trace and everything works well.

now i want to send this string to the chat window.

//////////////////////////////////////////////////////////////////////////


var count_length = 0;
var chk_end = new Boolean(0);

function OnEvent_Timer(TimerId)
{

var send_string = "";

if (TimerId == "send_timer_folder" && chk_end == 0)
{
send_string = final_final_folder.substr(count_length, 1000);
count_length += 1000;

if (send_string.length < 1)
{
chk_end = 1;
count_length = 0;
ChatWnd.SendMessage("no other folders.");   <<<< Error here ( chatwnd object undefined)
}
else
{
ChatWnd.SendMessage(send_string);    <<<< And here here ( chatwnd object undefined)
Debug.Trace(send_string);
send_string = "";
MsgPlus.AddTimer("send_timer_folder",100);
}
}
}

///////////////////////////////////////////////////////////////////

my question is, how can i write a function, that is called everytime the timer is up, and still have the ChatWnd object inside so i can use the SendMessage(string) command inside that function?


Thanks

This post was edited on 06-29-2006 at 12:07 PM by b0rna.
06-29-2006 12:02 PM
Profile E-Mail PM Find Quote Report
upsfeup
Junior Member
**


Posts: 67
Joined: Feb 2005
RE: [Help] My Problem...
You have to define which window to use. Of what contact you want to send the message to!

Ohh and try to find a better name for the topic! My problem doesn't say much about it!

This post was edited on 06-29-2006 at 12:42 PM by upsfeup.
06-29-2006 12:42 PM
Profile E-Mail PM Find Quote Report
b0rna
New Member
*


Posts: 11
Joined: Jun 2006
O.P. RE: [Help] My Problem...
ok. but that doesnt really help me much.
06-29-2006 12:59 PM
Profile E-Mail PM Find Quote Report
upsfeup
Junior Member
**


Posts: 67
Joined: Feb 2005
RE: [Help] My Problem...
Ok! How do you choose the window to send the information? probably another function such as OnEvent_WndMessageReceived. In this function you have a variable called ChatWnd so you write a global variable.
code:
targetWindow = ChatWnd
Then on your timer function you can use
code:
targetWindow.SendMessage("no other folders.");
06-29-2006 01:12 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: [Help] My Problem...
Ok the problem that your having is that ChatWnd isn't defined as anything. If you look at other examples or even a function (example : )

code:
OnEvent_ChatWndCreated(
    [object] ChatWnd
);

You see how ChatWnd is defined as an object. This is there because Plus! passes the chat window object to the function. This cannot be used the way you are doing it. If you make a global variable
code:
var ChatWnd;

And pass the ChatWnd from the OnEvent_ChatWndCreated to our global ChatWnd then you can use it. However this will overwrite the previous windows.

So if you were sending these messages to Person X and you open a conversation with Persion Y you will be sending them to Person Y and not Person X.

Hope that explains why your getting the error and how you can possibly fix it.
06-29-2006 01:14 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