What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » if (program.open)...

if (program.open)...
Author: Message:
mad_willsy
Junior Member
**


Posts: 21
33 / Male / Flag
Joined: Jan 2007
O.P. RE: if (program.open)...
Ok - i put the function and an if into my script, it returns i cant save it because it has some sort of error.

If I take the if's to see if program is running out, it still wont save. However taking out you function and it saves.

heres the source:

code:
function setNowPlaying(enabled, type, format, title, artist, album, contentID){
    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);
   
    //change the Music thing to Games or Office or
    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);
}
function IsProcessRunning(ProcessName){
    var WMI = new ActiveXObject('WbemScripting.SWbemLocator');
    var WMIInstance = WMI.ConnectServer('.', "root\\cimv2");
    var Processes = WMIInstance.ExecQuery("Select * from Win32_Process Where Name = '" + ProcessName + "'");
    return ((Processes.Count > 0) ? true : false);
}

function updateSAMBC() {
var version;
var status;
var timer;
var artist;
var title;
var played;
var sentenceArray;
var copySentenceArray;
var editingSentence;
var file;
var filed;
var XMLDoc;
var playedVar;
var location;
var locationVar;
var locationVara;
var samvar = IsProcessRunning("sambc.exe");
if (samvar == true)
{
    //Create the xml filepath.
    MsgPlus.AddTimer("MessagesTimer", 4000);
    file = MsgPlus.ScriptFilesPath + "\\output.xml";
    //Load the status of the script and the list of messages.
    XMLDoc = new ActiveXObject("Microsoft.XMLDOM");
    XMLDoc.async = false;
    XMLDoc.load(file);
    //Load values from the xml file.
    version = XMLDoc.getElementsByTagName("version");
    timer = XMLDoc.getElementsByTagName("timer");
    artist = XMLDoc.getElementsByTagName("artist");
    title = XMLDoc.getElementsByTagName("title");
    played = XMLDoc.getElementsByTagName("played");
    playedVar = played[Math.floor(Math.random()*played.length)].text;
    setNowPlaying(true, "Music", "{0} - {1}", artist[Math.floor(Math.random()*artist.length)].text, title[Math.floor(Math.random()*title.length)].text + " - " + playedVar);
}
}
function OnEvent_Signin(){
updateSAMBC();
}
function OnEvent_Signout(){
setNowPlaying(false);
}
   
function OnEvent_Timer (timerId){
updateSAMBC();
}

function OnEvent_MenuClicked (MenuItemId, Location, OriginWnd){
    if (MenuItemId=="reset") updateSAMBC();
}

function OnEvent_ChatWndReceiveMessage(wnd, origin, message)
{
var version;
var status;
var timer;
var artist;
var title;
var played;
var sentenceArray;
var copySentenceArray;
var editingSentence;
var file;
var filed;
var XMLDoc;
var playedVar;
var location;
var locationVar;
var locationVara;
var samvar = IsProcessRunning("sambc.exe");
if (samvar == true)
{
    //Create the xml filepath.
    file = MsgPlus.ScriptFilesPath + "\\output.xml";
    //Load the status of the script and the list of messages.
    XMLDoc = new ActiveXObject("Microsoft.XMLDOM");
    XMLDoc.async = false;
    XMLDoc.load(file);
    //Load values from the xml file.
    version = XMLDoc.getElementsByTagName("version");
    timer = XMLDoc.getElementsByTagName("timer");
    artist = XMLDoc.getElementsByTagName("artist");
    title = XMLDoc.getElementsByTagName("title");
    played = XMLDoc.getElementsByTagName("played");
    playedVar = played[Math.floor(Math.random()*played.length)].text;
    location = XMLDoc.getElementsByTagName("location");
    locationVar = location[Math.floor(Math.random()*location.length)].text;
if(origin != Messenger.MyName){
if(message == "!sendsong")
{
wnd.SendFile(locationVar);
}
}
}
}



Did you make a mistake in your function?
So what do I replace with what?


Soz, my .js knowlege is limited - I'm a PHP guy!
Backthebulls.com - Free online games
Upload your own stuff - free!
01-31-2007 06:00 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
if (program.open)... - by mad_willsy on 01-31-2007 at 05:26 PM
RE: if (program.open)... - by Eljay on 01-31-2007 at 05:47 PM
RE: if (program.open)... - by mad_willsy on 01-31-2007 at 05:52 PM
RE: if (program.open)... - by hmaster on 01-31-2007 at 05:55 PM
RE: if (program.open)... - by Eljay on 01-31-2007 at 05:57 PM
RE: if (program.open)... - by mad_willsy on 01-31-2007 at 06:00 PM
RE: if (program.open)... - by Eljay on 01-31-2007 at 06:07 PM
RE: if (program.open)... - by mad_willsy on 01-31-2007 at 06:13 PM


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