SRL Archive - Test corner

MSN Status


nielsie95

2010-06-28 09:00:08

Hey there,

I'm not sure if I've seen this before, but I'll post it anyway. Here's how to show a script's status through MSN (Live) Messenger:


program MSNStatus;

type
TWideCharArray = array of WideChar;
TCopyDataStruct = record
dwData: Integer;
cbData: Integer;
lpData: TWideCharArray;
end;

function FindWindow(lpClassName: string; lpWindowName: string): HWND; external 'FindWindowA@user32.dll stdcall';
function SendMessage(Wnd: HWND; msg: Cardinal; wParam: Integer; var lParam: TCopyDataStruct): Integer; external 'SendMessageA@user32.dll stdcall';

function StringToCharArray(s: widestring): TWideCharArray;
var
i, l: Integer;
begin
l := Length(s);
SetLength(Result, l + 1);
for i := l downto 1 do
Result[i - 1] := s[i];
Result[l] := #0;
end;

procedure msnStatus(sName, sStatus: widestring);
var
s: widestring;
cds: TCopyDataStruct;
msn: HWND;
begin
s := Format('\0Music\0%d\0%s\0%s\0%s\0', [1, '{0} - {1}', sName, sStatus]);

cds.dwData := $547;
cds.cbData := 2 + Length(s) * 2;
cds.lpData := StringToCharArray(s);

msn := FindWindow('MsnMsgrUIManager', '');
if (msn > 0) then
SendMessage(msn, $004A, 0, cds);
end;

begin
msnStatus('MyScript', '170 logs');
end.

This only works if the user has the option enabled to show the current song that is playing. It should work in both SCAR (API Calls enabled) and Simba. I'm not sure with which MSN versions it works. I have v14 and it works for me. If it works/doesn't work for you, could you post the version? :)

~Nielsie95

Sir R. M8gic1an

2010-06-28 09:08:46

lol nice.

~RM

Sabzi

2010-06-28 09:35:10

Same version, working.
Very nice, indeed.
I don't think I will use this tho :p.

"Hey, look, what is he listening to?"
"I dunno, never heard about MSI_Varrock_Trees - 500 log"

nielsie95

2010-06-28 09:43:50

How about "Mindless Self Indulgence - Molly"? :p


http://www.youtube.com/watch?v=uHjPINwTQZ0

Wizzup?

2010-06-28 13:16:19

Couldn't you load a library that actually implements the MSN protocol? Would probably be much more useful. ;)

nielsie95

2010-06-28 13:30:15

Why? Then you probably couldn't access your account when autoing?

Wizzup?

2010-06-28 14:16:27

From: nielsie95
Why? Then you probably couldn't access your account when autoing?


You could make another account… ;)

Actually, I can think of a few ways to do it… But most would involve IRC. (Which is much easier as a protocol anyway)

nielsie95

2010-06-28 14:24:53

You want to change your MSN status through IRC? Why? This is much easier..

3Garrett3

2010-06-28 16:18:04

From: Wizzup?
You could make another account… ;)


Definitely the easiest way. I wouldn't use it on my msn, but if I created a new account just for it, I would be able to use it, and see it if I added the proggy msn to my personal one.

Wizzup?

2010-06-28 17:16:42

From: nielsie95
You want to change your MSN status through IRC? Why? This is much easier..


It means I'll have to be running the Microsoft MSN client. A lot of people either use a different client, or even a different operating system.

Change MSN status on IRC? Very simple with bitlbee… ;)

Sir R. M8gic1an

2010-06-28 21:02:02

heh, if this is actually going to turn into something bigger, I'd have the script sending me the proggies through msn, as well as any randoms it runs into and so on.

~RM

Press Play

2010-07-03 21:51:31

It works for me. This is really great. I might use it in one of my private scripts. I like RM's idea ^^

:)