|  
 Change state when a specific program starts - 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: WLM Plus! General (/forumdisplay.php?fid=23)
 +----- Thread: Change state when a specific program starts (/showthread.php?tid=97573)
 Change state when a specific program starts by SuperAs on 05-10-2011 at 03:38 PM
 
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.
 RE: Change state when a specific program starts by matty on 05-10-2011 at 04:55 PM
 
Untested but something like this could work...
 
 js 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;
 }
 
 RE: RE: Change state when a specific program starts by SuperAs on 05-11-2011 at 11:41 AM
 
 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!.
 RE: Change state when a specific program starts by matty on 05-11-2011 at 05:26 PM
 
 quote:No you don't have to change that; however if it is not working try this:Originally posted by SuperAs
 1.- "root\\cimv2" should be changed?... if so, to what?.
 
 
 js code:function GetProcessName(){
 return new ActiveXObject("WbemScripting.SWbemLocator").ConnectServer(".").ExecQuery("SELECT * FROM Win32_Process WHERE Name LIKE '%" + sExeName + "%'").Count !== 0;
 }
 
 quote:If you mean personalized status; those are not accessible using Plus! scripting.Originally posted by SuperAs
 2.- If I want to change to a custom state, how should I have to change the line:
 
 
 |