What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » WLM Plus! General » Change state when a specific program starts

Change state when a specific program starts
Author: Message:
SuperAs
New Member
*


Posts: 2
Joined: May 2011
O.P. Change state when a specific program starts
Hello,

I would like to know if Messenger Plus! include the posibility to define a custom status that activate automatically when a specific program starts.

For example, if I start some_program.exe, then Messenger state is changed automatically to "busy" (for example).

Thanks in advance.
05-10-2011 03:38 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Change state when a specific program starts
Untested but something like this could work...

Javascript code:
// Add the EXE name below
var sExeName = '';var bEnabled = false;
var nPreviousStatus;
 
function OnEvent_Initialize() {
    if (Messenger.MyStatus < STATUS_OFFLINE) return false;
    MsgPlus.AddTimer('_ExeCheck', 100);
}
 
function OnEvent_SigninReady() {
    OnEvent_Initialize();
}
 
function OnEvent_Timer(sTimerId) {
    if (GetProcessName() === true && bEnabled === false) {
        bEnabled = true;
        nPreviousStatus = Messenger.MyStatus;
        Messenger.MyStatus = STATUS_BUSY
    } else if (GetProcessName() === false && bEnabled === true) {
        bEnabled = false;
        Messenger.MyStatus = nPreviousStatus;
    }
    MsgPlus.AddTimer('_ExeCheck', 100);
}
 
function GetProcessName(){
    return new ActiveXObject("WbemScripting.SWbemLocator").ConnectServer(".", "root\\cimv2").ExecQuery("SELECT * FROM Win32_Process WHERE Name LIKE '%" + sExeName + "%'").Count !== 0;
}


This post was edited on 05-10-2011 at 04:56 PM by matty.
05-10-2011 04:55 PM
Profile E-Mail PM Find Quote Report
SuperAs
New Member
*


Posts: 2
Joined: May 2011
O.P. RE: RE: Change state when a specific program starts
quote:
Originally posted by matty

function GetProcessName(){
    return new ActiveXObject("WbemScripting.SWbemLocator").ConnectServer(".", "root\\cimv2").ExecQuery("SELECT * FROM Win32_Process WHERE Name LIKE '%" + sExeName + "%'").Count !== 0;
}[/code]

Thank you very much matty. Just 2 little questions from a newbie...

1.- "root\\cimv2" should be changed?... if so, to what?.
2.- If I want to change to a custom state, how should I have to change the line:

Messenger.MyStatus = STATUS_BUSY

Where can I find the constant name of my MSN customized state?

Ty again!.
05-11-2011 11:41 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Change state when a specific program starts
quote:
Originally posted by SuperAs
1.- "root\\cimv2" should be changed?... if so, to what?.
No you don't have to change that; however if it is not working try this:
Javascript code:
function GetProcessName(){
    return new ActiveXObject("WbemScripting.SWbemLocator").ConnectServer(".").ExecQuery("SELECT * FROM Win32_Process WHERE Name LIKE '%" + sExeName + "%'").Count !== 0;
}

quote:
Originally posted by SuperAs
2.- If I want to change to a custom state, how should I have to change the line:
If you mean personalized status; those are not accessible using Plus! scripting.

This post was edited on 05-11-2011 at 05:34 PM by matty.
05-11-2011 05:26 PM
Profile E-Mail 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