What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » How To Display The Time in Media Message?

How To Display The Time in Media Message?
Author: Message:
ainain
New Member
*


Posts: 8
Joined: Jan 2009
O.P. How To Display The Time in Media Message?
please give me a script.
01-03-2009 06:29 PM
Profile E-Mail PM Find Quote Report
Chris4
Elite Member
*****

Avatar

Posts: 4461
Reputation: 84
33 / Male / Flag
Joined: Dec 2004
RE: How To Display The Time in Media Message?
If you search the Scripts Database you'd find it in less than a minute. (Y)

Date+Time Script
Twitter: @ChrisLozeau
01-03-2009 06:36 PM
Profile PM Find Quote Report
ainain
New Member
*


Posts: 8
Joined: Jan 2009
O.P. RE: How To Display The Time in Media Message?
i don't know how to make it. please help me

Date+Time Script only display personal message.
i don't know how to change to media message.
please teach me

This post was edited on 01-03-2009 at 06:50 PM by ainain.
01-03-2009 06:48 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: How To Display The Time in Media Message?
There is a function that allows one to change their media mesage.

Okay, you want to have the time in your media message. What you should do, is create a Date object like this:

code:
var CurDateTime = new Date();

Then you can retrieve a time string using toLocaleTimeString() like this:

code:
var Time = CurDateTime.toLocaleTimeString();

Then you should pass the Time variable to the function below.

code:
/*

function SetNowPlaying([boolean] enabled: specifies whether to enable the message or not,
[string] type: the type of message, can be Music, Games, Office,
[string] format: the format, see below,
[string] title: title of the 'song',
[string] artist: artist of the 'song',
[string] album: album of the 'song',
[string] contentID: content ID of the 'song', can be anything);
ALL PARAMETERS OPTIONAL


FORMAT DESCRIPTION

The format is defined by 4 numbers: 0, 1, 2 and 3. These represent respectively Title, Artist, Album, ContentID. Enclose the numbers in { these brackets }. Valid format would be:

{3}: {0} - {1} (on "{2}")

This would result in:

<CONTENTID>: Proud mary - John Fogerty (on "The long road home")

Experiment with this.

*/
// Function by -dt-, modified slightly by myself
function SetNowPlaying(enabled, type, format, title, artist, album, contentID){
    if(typeof(type) == "undefined")type = "Music";
    if(typeof(format) == "undefined")format = "{0}";
    if(typeof(title) == "undefined")title = "";
    if(typeof(artist) == "undefined")artist = "";
    if(typeof(album) == "undefined")album = "";
    if(typeof(contentID) == "undefined")contentID = "";
    enabled = Math.abs(enabled);
    var WM_COPYDATA = 0x4A;
    var MediaMessage = "FMD\\0" + type + "\\0" + enabled + "\\0" + format +"\\0" + title +"\\0" + artist + "\\0" + album + "\\0" + contentID + "\\0";
    var song = Interop.Allocate((MediaMessage.length + 1) * 2);
    song.WriteString(0, MediaMessage);
    var copyDataStruct = Interop.Allocate(12);
    copyDataStruct.WriteDWORD(0, 0x547); //dwData
    copyDataStruct.WriteDWORD(4, song.Size); //cbData
    copyDataStruct.WriteDWORD(8, song.DataPtr);  //lpData
    var hMSGRUI = 0;
    do{
        hMSGRUI = Interop.Call("User32", "FindWindowExW", 0, hMSGRUI, "MsnMsgrUIManager", 0);
        if(hMSGRUI > 0){
            Interop.Call("User32", "SendMessageW", hMSGRUI, WM_COPYDATA, 0, copyDataStruct);   
        }
    }while(hMSGRUI != 0);
    var listeningtoshouldbe = Messenger.MyCurrentMedia;
}


For further explanation about JScript, the scripting language of Plus!, please refer to Microsoft's JScrit user's guide and JScript language reference.

Furthermore, you may want to update your media message every once in a while. To do so, you need timers. You can use the following code to add a timer to your script:

code:
MsgPlus.AddTimer("TmrUpdateMedia",120000 /* 2 minutes is 120 seconds, is 120,000 milliseconds */);

Please refer to the scripting documentation about timers. Every time OnEvent_Timer() is called by Plus!, you need to add the same timer again.

This post was edited on 01-03-2009 at 08:47 PM by SmokingCookie.
01-03-2009 08:39 PM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: How To Display The Time in Media Message?
That function won't work...

Print is not defined :p
<Eljay> "Problems encountered: shit blew up" :zippy:
01-03-2009 08:41 PM
Profile PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: How To Display The Time in Media Message?
Now it does :P
01-03-2009 08:43 PM
Profile PM Find Quote Report
ainain
New Member
*


Posts: 8
Joined: Jan 2009
O.P. RE: How To Display The Time in Media Message?
function won't work

may you write full script to me

This post was edited on 01-04-2009 at 08:37 AM by ainain.
01-04-2009 08:36 AM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: How To Display The Time in Media Message?
Why doesn't it work? What arguments have you passed to SetNowPlaying()?
01-04-2009 09:01 AM
Profile PM Find Quote Report
ainain
New Member
*


Posts: 8
Joined: Jan 2009
O.P. RE: RE: How To Display The Time in Media Message?
quote:
Originally posted by SmokingCookie
Why doesn't it work? What arguments have you passed to SetNowPlaying()?

may you write full script to me
01-05-2009 01:57 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: How To Display The Time in Media Message?
No, not now.

First, I would like to know what arguments you pass to SetNowPlaying(), so I can try and find any mistakes made by either of us. There may also be a mistake in the function that calls SetNowPlaying(). It is therefore I would like to see your interpretation of the script, so you can learn from it ;)
01-05-2009 06:00 PM
Profile 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