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:
ArkaneArkade
Full Member
***

Avatar
The One and Only

Posts: 193
Reputation: 5
38 / Male / Flag
Joined: Mar 2007
O.P. Huh?  Newbie Help
Hey guys, I'm looking for a little help witha  couple of minor issues I've been having.  I think they're really easy to sort, but then again I've been unable to sort them so...

The first is with arrays.  I've not used them since uni 3 years ago, so I'm not entirely sure how to do it.  I have a script that needs to act upon recieving a message from a contact, but only on the first message, similar to the MSN popups, so I've made it work by adding names to an array as I recieve messages from them.  This has worked to stop the function being triggered multiple times, but I dont know how to remove them from the array so they dont trigger again after the window has been closed.  Can anyone tell me how to delete an entry from an array?

The second is with a media script I've made.  It's meant to get media information froma  network server, and make that into my PSM, however because of the way it's working it sometimes screws up and changes teh actual PSM to be the media info, so it still displays after the media has stopped.  I'd like to know if theres a way to change the actual messenger media variable with Plus, instead of the PSM, to make this issue go away... or if there is any other method which may solve the problem.

Cheers all
[Image: adsig.jpg]
09-01-2007 02:06 AM
Profile E-Mail PM Web Find Quote Report
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
29 / Male / Flag
Joined: Nov 2006
Status: Away
RE: Newbie Help
i could help with number 1.


use the "splice" method/thingy (whatever you call it)

look on W3cschools.

code:
//used in WLMini Media Player
PLS.splice(0,1); // deletes PLS[0]
[quote]
Ultimatess6
: What a noob mod
09-01-2007 03:06 AM
Profile PM Web Find Quote Report
ArkaneArkade
Full Member
***

Avatar
The One and Only

Posts: 193
Reputation: 5
38 / Male / Flag
Joined: Mar 2007
O.P. RE: Newbie Help
OK, cheers mate.  I figured out some more of my prolem too now.  I was using a friends reccommendation to make the array numbered, but now I'm changing that to just use the contacts email for the array cell, and setting the data as 1.  Hopefully it will make thing much, much simpler, without the need to search trhough various loops.  Thanks again mate.
[Image: adsig.jpg]
09-01-2007 03:35 AM
Profile E-Mail PM Web Find Quote Report
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
ArkaneArkade
Full Member
***

Avatar
The One and Only

Posts: 193
Reputation: 5
38 / Male / Flag
Joined: Mar 2007
O.P. RE: Newbie Help
Thats perfect mate.  I'll give it a try, and maybe all my problems will be solved.  I got the first script working perfectly now, and there wont be any issues as long as the ChatWnd handle is unique to each chat.
Thanks for all the help guys
StevieD
WEll, it took me a while, but I got the setNowPlaying function working.  Now all the scripts are going just how I want them, so thanks to all for the help.  :D

Many cheers to -dt- as well for his code. ;)  Worked perfectly.
[Image: adsig.jpg]
09-02-2007 02:08 AM
Profile E-Mail PM Web 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