How To Display The Time in Media Message? - 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: How To Display The Time in Media Message? (/showthread.php?tid=88082)
How To Display The Time in Media Message? by ainain on 01-03-2009 at 06:29 PM
please give me a script.
RE: How To Display The Time in Media Message? by Chris4 on 01-03-2009 at 06:36 PM
If you search the Scripts Database you'd find it in less than a minute.
Date+Time Script
RE: How To Display The Time in Media Message? by ainain on 01-03-2009 at 06:48 PM
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
RE: How To Display The Time in Media Message? by SmokingCookie on 01-03-2009 at 08:39 PM
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.
RE: How To Display The Time in Media Message? by Spunky on 01-03-2009 at 08:41 PM
That function won't work...
Print is not defined
RE: How To Display The Time in Media Message? by SmokingCookie on 01-03-2009 at 08:43 PM
Now it does
RE: How To Display The Time in Media Message? by ainain on 01-04-2009 at 08:36 AM
function won't work
may you write full script to me
RE: How To Display The Time in Media Message? by SmokingCookie on 01-04-2009 at 09:01 AM
Why doesn't it work? What arguments have you passed to SetNowPlaying()?
RE: RE: How To Display The Time in Media Message? by ainain on 01-05-2009 at 01:57 PM
quote: Originally posted by SmokingCookie
Why doesn't it work? What arguments have you passed to SetNowPlaying()?
may you write full script to me
RE: How To Display The Time in Media Message? by SmokingCookie on 01-05-2009 at 06:00 PM
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
|