What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Newbie Help

Newbie Help
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: Newbie Help
As for your second problem, you can request the current media with Messenger.MyMedia. However, you can't set it using that method. Therefore, you'll need an extra function which sends a message to Messenger, telling it to change the media.

All credits for this one go to -dt-! ;)
code:
//Modifies the current media, thanks to -dt-!
/* Parameters:
   enabled (Boolean)        - Sets whether to enable or disable the media.
   type (String) [opt]      - The icon to display, can be "Music", "Games" or "Office"
   format (String) [opt]    - Format used for the media message. Can contain {0} for title, {1} for artist, etc. but can also be a simple message
   title (String) [opt]     - Title, replaced in format by {0}
   artist (String) [opt]    - Artist, replaced in format by {1}
   album (String) [opt]     - Album name, replaced in format by {2}
   contentID (String) [opt] - Content ID, replaced in format by {3}
*/
/* Examples:
   setNowPlaying(true, "Music", "Me - My crappy song") - Displays a music message.
   setNowPlaying(true, "Music", "{1} - {0}", "My crappy song", "Me") - Same as above, but by using title and artist fields.
   setNowPlaying(false) - Turns off the media message, Messenger will display your PSM.
*/
   
function setNowPlaying(enabled, type, format, title, artist, album, contentID) {
   //Set empty variables
   if(typeof(type) == "undefined")type = "Music";
   if(typeof(format) == "undefined")format = "";
   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;
   
   //Reference
   var song = Interop.Allocate(512);
   
   //Create the Media string
   song.WriteString(0, "\\0" + type + "\\0" + enabled + "\\0" + format +"\\0" + title +"\\0" + artist + "\\0" + album + "\\0" + contentID + "\\0");
   
   //Write our copyDataStruct Structure
   var copyDataStruct = Interop.Allocate(12);
   copyDataStruct.WriteDWORD(0, 0x547); //dwData
   copyDataStruct.WriteDWORD(4, song.Size); //cbData
   copyDataStruct.WriteDWORD(8, song.DataPtr);  //lpData
   
   //Send it to all open messengers
   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);
}

Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
09-01-2007 07:31 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Newbie Help - by ArkaneArkade on 09-01-2007 at 02:06 AM
RE: Newbie Help - by roflmao456 on 09-01-2007 at 03:06 AM
RE: Newbie Help - by ArkaneArkade on 09-01-2007 at 03:35 AM
RE: Newbie Help - by Matti on 09-01-2007 at 07:31 AM
RE: Newbie Help - by ArkaneArkade on 09-02-2007 at 02:08 AM


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