Shoutbox

Snarl - 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: Snarl (/showthread.php?tid=90601)

Snarl by AnyaAlstreim on 05-12-2009 at 02:21 PM

Hi,

Is there a script that would allow WLM updates to be displayed by Snarl (www[dot]fullphat[dot]net/applications/index[dot]html) instead?  So far I couldn't find one, so I was wondering if anyone made one yet?

Thanks


RE: Snarl by superaktieboy on 06-21-2010 at 06:26 PM

I know this post is quite old, but I would really like to see such script if it's possible!
Thanks


RE: Snarl by matty on 06-21-2010 at 06:41 PM

This was done with Growl... I just cannot find the thread.

[Script Request] Growl Notifications


RE: Snarl by superaktieboy on 06-21-2010 at 08:29 PM

aah cheers.. i've had a go with it.. however, when it comes to "OnEvent_ChatWndReceiveMessage", it seems to send all messages through, i read the scripting documentation, where it says that they are using the "Origin" argument to check whether this is the current user or not.
This is what i have so far, however it is failing miserably.. (the sign in and sign out works fine)

javascript code:
var signedInUser;
function snarl_notify(Message) {
    new ActiveXObject('WScript.Shell').Exec('C:\\Windows\\snarl_notify.exe snShowMessage 5 "Windows Live Messenger" "'+Message+'" "C:\\Windows\\icon.png"');
}
function OnEvent_ContactSignin(sEmail)  {
    snarl_notify(sEmail+"\nhas just signed in");
}

function OnEvent_ContactSignout(sEmail) {
    snarl_notify(sEmail+"\nsigned out");
}

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind) {
    if(signedInUser.Name != Origin) {
        snarl_notify(ChatWnd+'**'Origin++"**"+Message);
    }
    return Message;
}

function shorten(sText, max) {
    sNewText = sText.split('', max);
    return sNewText.join('');
}

function OnEvent_Signin(sEmail) {
    signedInUser = GetContact(sEmail);
}

so my question, how do i make it so that only the messages from the other end come up? and if possible, only when the window hasn't been created yet (like msn's original behaviour..)

also, how do i make sure msn's original notifiers don't come up?
RE: Snarl by matty on 06-21-2010 at 09:55 PM

js code:
var oChatWnds = {};

function OnEvent_ChatWndSendMessage(pChatWnd, sMessage) {
    oChatWnds[pChatWnd.Handle] = sMessage;
}

function OnEvent_ChatWndReceiveMessage(pChatWnd, sOrigin, sMessage, nKind) {
    if (oChatWnds[pChatWnd.Handle] === sMessage) {
        delete oChatWnds[pChatWnd.Handle];
    } else {
        snarl_notify(sMessage);
    }
}

function OnEvent_ContactSignin(sEmail)  {
    snarl_notify(sEmail+"\nhas just signed in");
}

function OnEvent_ContactSignout(sEmail) {
    snarl_notify(sEmail+"\nsigned out");
}

function OnEvent_ChatWndDestroyed(pChatWnd) {
    delete oChatWnds[pChatWnd.Handle];
}

function snarl_notify(sMessage) {
    new ActiveXObject('WScript.Shell').Exec('C:\\Windows\\snarl_notify.exe snShowMessage 5 "Windows Live Messenger" "'+Message+'" "C:\\Windows\\icon.png"');
}

RE: Snarl by superaktieboy on 06-22-2010 at 01:09 AM

cheers dude that worked :)


RE: Snarl by superaktieboy on 06-22-2010 at 01:44 AM

right, i have the final "product", no clue how to bundle it and all, and to be quite frank, it's worthless since it requires other steps for installation.. first of all download snarl CMD and put the .exe in your windows folder (or anywhere else for that matter)
http://tlhan-ghun.de/?q=node/59

then download the icon attached and put it somewhere,

then copy and paste the following into a new script and edit the top 4 variables.

javascript code:
/**
* Just edit the variables.
*/
var boolDontNotifyOnBusy = true; // disable on Busy? true for yes, false for no
var boolNotifyOnSignOut = true; // notify when a contact signs out? true for yes, false for no
var sSnarlCMD = "C:\\Windows\\Snarl_CMD.exe"; // The location to snarl CMD, make sure you escape backslashes (type \\ instead of \)
var sMSNIcon = "C:\\Windows\\icon.png"; // [optional] The location to MSN icon.


// don't edit anything below this line unless you know what you're doing

var oChatWnds = {};
var boolMessengerLocked = false;

function OnEvent_ChatWndSendMessage(pChatWnd, sMessage) {
    oChatWnds[pChatWnd.Handle] = sMessage;
}

function OnEvent_ChatWndReceiveMessage(pChatWnd, sOrigin, sMessage, nKind) {

    if (oChatWnds[pChatWnd.Handle] === sMessage) {
        delete oChatWnds[pChatWnd.Handle];
    } else {
        if (!(Messenger.MyStatus == 4 && boolDontNotifyOnBusy == true)) {
            var re = new RegExp("\([0-9][0-9]:[0-9][0-9]\)", 'ig');
            if(re.exec(sOrigin.substring(0, 7))) {
                sOrigin = sOrigin.substring(7);
            }
            snarl_notify(sOrigin+"\n"+sMessage);
        }
    }
}

function OnEvent_ContactSignin(sEmail) {
    snarl_notify(getContactByEmail(sEmail).Name+"\nhas just signed in");
}

function OnEvent_ContactSignout(sEmail) {
    if(boolNotifyOnSignOut == true) {
        snarl_notify(getContactByEmail(sEmail).Name+"\nsigned out");
    }
}

function OnEvent_ChatWndDestroyed(pChatWnd) {
    delete oChatWnds[pChatWnd.Handle];
}

function snarl_notify(sMessage) {
    if(boolMessengerLocked == false && sSnarlCMD != '') {
        sSnarlIcon = '';
        if(sMSNIcon != '') {
            sSnarlIcon = ' "'+sMSNIcon+'"';
        }
        new ActiveXObject('WScript.Shell').Exec(sSnarlCMD+' snShowMessage 5 "Windows Live Messenger" "'+MsgPlus.RemoveFormatCodes(sMessage)+'"'+sSnarlIcon);
    }
}

function getContactByEmail(sEmail) {
    var Contacts = Messenger.MyContacts;
    return Contacts.GetContact(sEmail);
}

function OnEvent_MessengerUnlocked() {
    boolMessengerLocked = false;
}

function OnEvent_MessengerLocked() {
    boolMessengerLocked = true;
}


and matty, thanks for the help.. :)
RE: Snarl by whiz on 06-22-2010 at 09:13 AM

Why not put the application and icon in the script folder?  Then you can pack the whole lot together.

To compile a script, you need to put all of the files in a ZIP folder, and then change the extension to ".plsc" (if you can't see extensions, go to Tools > Folder Options > View > Hide extensions for known file types (uncheck).


RE: Snarl by matty on 06-22-2010 at 12:58 PM

quote:
Originally posted by whiz
Why not put the application and icon in the script folder?  Then you can pack the whole lot together.

To compile a script, you need to put all of the files in a ZIP folder, and then change the extension to ".plsc" (if you can't see extensions, go to Tools > Folder Options > View > Hide extensions for known file types (uncheck).
You also need to include a ScriptInfo.xml file...

Also superaktieboy,

js code:
if (!(Messenger.MyStatus == 4 &&  boolDontNotifyOnBusy == true)) {
The above line instead of using 4 you can use
js code:
if (!(Messenger.MyStatus == STATUS_BUSY &&  boolDontNotifyOnBusy == true)) {