Shoutbox

[?] retrieve contact status - 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)
+----- Thread: [?] retrieve contact status (/showthread.php?tid=69274)

[?] retrieve contact status by Cartox on 12-08-2006 at 10:12 AM

Hi,I think the folowing code is from the Open notifier Beta 0.5 from nx01rules.googlepages.com/
Is still use this code because it stil works (i know it isn't reliable :D)

I would like  the popup that's created to show the contact's status aswel.

so it would be somethin like "Contact (Away) has opened a conversation/session with you."

I've tried by adding Contact.Status after contact.name
but it didn't work.

do you have to make a list with the name's of the status somewhere?

code:
var PluginObj;

function OnEvent_Initialize(MessengerStart)
{
    if ( PluginObj == null )
    {
        OnEvent_Signin(Messenger.MyEmail);
    }
}

function OnEvent_Uninitialize(MessengerExit)
{
    PluginObj = null;
}

function SetWindowText(hWnd, sText)
{
    Interop.Call('user32', 'SetWindowTextW', hWnd, sText);
}

function OnWndOpenedEvent_EditTextChanged(PlusWnd,ControlId)
{
    if ( PlusWnd.GetControlText(ControlId) != "" )
    {
        var Contacts = Messenger.MyContacts;
        var Contact = Contacts.GetContact(PlusWnd.GetControlText(ControlId));
        if ( Contact == null )
        {
            MsgPlus.DisplayToast("Window Opened", PlusWnd.GetControlText(ControlId) + " has opened a conversation with you.", "", "ToastCallback", PlusWnd.GetControlText(ControlId));
        }
        else
        {
            MsgPlus.DisplayToast("Window Opened", Contact.Name + " has opened a conversation with you.", "", "ToastCallback", Contact.Email);
        }
        PlusWnd.SetControlText(ControlId, "");
    }
}

function ToastCallback(Param)
{
    Messenger.OpenChat(Param);
}

function LoadPlugin_VB(ProgId, CurrentEmail, OpenTextControlhWnd)
{
    PluginObj = new ActiveXObject(ProgId);
    if(PluginObj)
    {
        if(PluginObj.Initialize(8, CurrentEmail + "|" + OpenTextControlhWnd, undefined) == false)
        {
            MsgPlus.DisplayToast("Open Notifier", "Notifier was unable to load for an unknown reason");
        }
    }
}

function OnEvent_Signin(Email)
{
    var pOpenWindow = MsgPlus.CreateWnd("Opened.xml","WndOpened",1);
    SetWindowText(pOpenWindow.Handle, Email + "MSGPLNOTIFOPEN");

    LoadPlugin_VB("MSNWON.WindowNotifier", Email, pOpenWindow.GetControlHandle("Edt1"), 0);
}

function OnEvent_Signout(Email)
{
    PluginObj = null;
}


RE: [?] retrieve contact status by Felu on 12-08-2006 at 10:25 AM

Contact.Status returns numerical values for each status. You'll have to replace 'em [Image: msn_tongue.gif].

code:
Status = new Array('Unknown', 'Offline', 'Unknown', 'Online', 'Busy', 'Be Right Back', 'Idle', 'Away', 'In a Call', 'Out to Lunch');
Status[Contact.Status]
That should do it [Image: msn_happy.gif].
RE: [?] retrieve contact status by Cartox on 12-08-2006 at 10:39 AM

thx, but can you help me a little more :$
Where to place that code and can i just ad

code:
MsgPlus.DisplayToast("Window Opened", Contact.Name + Contact.status + " has opened a conversation with you.", "", "ToastCallback", Contact.Email);
to it ?(contact.status)
the only script i ever made was to jump online a couple of times :)
RE: [?] retrieve contact status by Felu on 12-08-2006 at 10:45 AM

code:
var PluginObj;
Status = new Array('Unknown', 'Offline', 'Unknown', 'Online', 'Busy', 'Be Right Back', 'Idle', 'Away', 'In a Call', 'Out to Lunch');

function OnEvent_Initialize(MessengerStart)
{
    if ( PluginObj == null )
    {
        OnEvent_Signin(Messenger.MyEmail);
    }
}

function OnEvent_Uninitialize(MessengerExit)
{
    PluginObj = null;
}

function SetWindowText(hWnd, sText)
{
    Interop.Call('user32', 'SetWindowTextW', hWnd, sText);
}

function OnWndOpenedEvent_EditTextChanged(PlusWnd,ControlId)
{
    if ( PlusWnd.GetControlText(ControlId) != "" )
    {
        var Contacts = Messenger.MyContacts;
        var Contact = Contacts.GetContact(PlusWnd.GetControlText(ControlId));
        if ( Contact == null )
        {
            MsgPlus.DisplayToast("Window Opened", PlusWnd.GetControlText(ControlId) + " has opened a conversation with you.", "", "ToastCallback", PlusWnd.GetControlText(ControlId));
        }
        else
        {
            MsgPlus.DisplayToast("Window Opened", Contact.Name + "("+Status[Contact.Status]+ ")" + " has opened a conversation with you.", "", "ToastCallback", Contact.Email);
        }
        PlusWnd.SetControlText(ControlId, "");
    }
}

function ToastCallback(Param)
{
    Messenger.OpenChat(Param);
}

function LoadPlugin_VB(ProgId, CurrentEmail, OpenTextControlhWnd)
{
    PluginObj = new ActiveXObject(ProgId);
    if(PluginObj)
    {
        if(PluginObj.Initialize(8, CurrentEmail + "|" + OpenTextControlhWnd, undefined) == false)
        {
            MsgPlus.DisplayToast("Open Notifier", "Notifier was unable to load for an unknown reason");
        }
    }
}

function OnEvent_Signin(Email)
{
    var pOpenWindow = MsgPlus.CreateWnd("Opened.xml","WndOpened",1);
    SetWindowText(pOpenWindow.Handle, Email + "MSGPLNOTIFOPEN");

    LoadPlugin_VB("MSNWON.WindowNotifier", Email, pOpenWindow.GetControlHandle("Edt1"), 0);
}

function OnEvent_Signout(Email)
{
    PluginObj = null;
}
Edited
RE: [?] retrieve contact status by Cartox on 12-08-2006 at 10:57 AM

there seems to be a error on line 34, a "]" is missing


RE: [?] retrieve contact status by NanaFreak on 12-08-2006 at 10:58 AM

code:
var PluginObj;
Status = new Array('Unknown', 'Offline', 'Unknown', 'Online', 'Busy', 'Be Right Back', 'Idle', 'Away', 'In a Call', 'Out to Lunch');

function OnEvent_Initialize(MessengerStart)
{
if ( PluginObj == null )
{
OnEvent_Signin(Messenger.MyEmail);
}
}

function OnEvent_Uninitialize(MessengerExit)
{
PluginObj = null;
}

function SetWindowText(hWnd, sText)
{
Interop.Call('user32', 'SetWindowTextW', hWnd, sText);
}

function OnWndOpenedEvent_EditTextChanged(PlusWnd,ControlId)
{
if ( PlusWnd.GetControlText(ControlId) != "" )
{
var Contacts = Messenger.MyContacts;
var Contact = Contacts.GetContact(PlusWnd.GetControlText(ControlId));
if ( Contact == null )
{
MsgPlus.DisplayToast("Window Opened", PlusWnd.GetControlText(ControlId) + " has opened a conversation with you.", "", "ToastCallback", PlusWnd.GetControlText(ControlId));
}
else
{
MsgPlus.DisplayToast("Window Opened", Contact.Name + "("+Status[Contact.Status]+ ")" + " has opened a conversation with you.", "", "ToastCallback", Contact.Email);
}
PlusWnd.SetControlText(ControlId, "");
}
}

function ToastCallback(Param)
{
Messenger.OpenChat(Param);
}

function LoadPlugin_VB(ProgId, CurrentEmail, OpenTextControlhWnd)
{
PluginObj = new ActiveXObject(ProgId);
if(PluginObj)
{
if(PluginObj.Initialize(8, CurrentEmail + "|" + OpenTextControlhWnd, undefined) == false)
{
MsgPlus.DisplayToast("Open Notifier", "Notifier was unable to load for an unknown reason");
}
}
}

function OnEvent_Signin(Email)
{
var pOpenWindow = MsgPlus.CreateWnd("Opened.xml","WndOpened",1);
SetWindowText(pOpenWindow.Handle, Email + "MSGPLNOTIFOPEN");

LoadPlugin_VB("MSNWON.WindowNotifier", Email, pOpenWindow.GetControlHandle("Edt1"), 0);
}

function OnEvent_Signout(Email)
{
PluginObj = null;
}
fixed it for you
RE: [?] retrieve contact status by Cartox on 12-08-2006 at 11:07 AM

thx, felu and nana for the help so far
but it doesn't seem to work now either

quote:
Function called: OnEvent_Uninitialize
Script has been stopped
Script is starting
Script is now loaded and ready
Function called: OnEvent_Initialize
Error: Object missing.
       Line: 60. Code: -2146827864.
Function OnEvent_Initialize returned an error. Code: -2147352567


RE: [?] retrieve contact status by Felu on 12-08-2006 at 11:19 AM

code:
var pOpenWindow = MsgPlus.CreateWnd("Opened.xml","WndOpened",1);
//Line 59
SetWindowText(pOpenWindow.Handle, Email + "MSGPLNOTIFOPEN");//Line60

Is the Window working?
RE: [?] retrieve contact status by Cartox on 12-08-2006 at 11:23 AM

with the last modifictation i get this in the debug

code:
Script is starting
Script is now loaded and ready
Function called: OnEvent_Initialize
Error: Object vereist.
       Line: 60. Code: -2146827864.
Function OnEvent_Initialize returned an error. Code: -2147352567

no, no popup showing

edit: it was line 60 again srry


EDIT2:
Yea, it works
many thanks :D

i now see the problem also
i had created a new scrip but in that folder was no "opened.xml"
RE: [?] retrieve contact status by Felu on 12-08-2006 at 11:42 AM

Here is the script. Download attachment :).


RE: [?] retrieve contact status by Cartox on 12-08-2006 at 12:23 PM

Ok i got it working now..great :D

I imported your script,but it gave the error on line 34 again.

so i replaced the code with the code nana gave me.
and the error was solved, just to let you know

Thx felu and nana for putting so much work in too it ;)