What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » wanna edit this. Script - Simple Display Picture Changer by Equinox

wanna edit this. Script - Simple Display Picture Changer by Equinox
Author: Message:
aaArcher_
New Member
*


Posts: 3
Joined: Oct 2006
O.P. wanna edit this. Script - Simple Display Picture Changer by Equinox
Okay. So I don't want it to restrict my online icon, and made a change..
code:
//=====================================================
// Simple Display Picture Changer
// By Equinox
// email: equinox102@hotmail.com
// v.0.4
//=====================================================
// To change status pictures, replace the jpeg files in
// the images folder within the script's folder.
//
// To bring up the options dialog type /statusdpoptions
// in any chat window.  If you wish  to save your curr-
// ent display picture as your default online picture.
// Type /statusdpoptions to bring up the options dialog
// make sure the option button is selected, then click
// save.
//
// If you have any questions or suggestions feel free
// to email me :)
//=====================================================

// Define variables
var onlinebool;
var FSO = new ActiveXObject("Scripting.FileSystemObject");
var onlinedpfile = FSO.BuildPath(MsgPlus.ScriptFilesPath, "\\images\\online.jpg");
var onlinedefault = FSO.BuildPath(MsgPlus.ScriptFilesPath, "\\images\\online.bkp");
var WScript = new ActiveXObject('WScript.Shell');
var winShell = new ActiveXObject("Shell.Application");

//On status change
function OnEvent_MyStatusChange(Stat) {

    changepic(Stat);
     
}

//On script start, call changepic
function OnEvent_Initialize(MessengerStart) {

    if(typeof(Messenger.MyUserId)!='unknown'){
   
    try {
        var onlinebool = WScript.RegRead(MsgPlus.ScriptRegPath + Messenger.MyEmail + "\\useonline");
            } catch(e) {
       
        plusWnd = MsgPlus.CreateWnd('window.xml', 'DpOptions');
        plusWnd.Button_SetCheckState('CkOnline', onlinebool);
    }
    }

    changepic(Messenger.MyStatus);
   

}

//When the user sends a message, check to see if it's an option
function OnEvent_ChatWndSendMessage(ChatWnd, Message){
   
    if(Message.toLowerCase() == "/statusdpoptions"){
       
       
        plusWnd = MsgPlus.CreateWnd('window.xml', 'DpOptions');
        plusWnd.Button_SetCheckState('CkOnline', onlinebool);
        return "";
       
    }
   
    return Message;
   
}

//When dialog save button clicked, save settings
function OnDpOptionsEvent_CtrlClicked(PlusWnd, ControlId){
       
    if(ControlId == "BtnOk"){
       
        online = PlusWnd.Button_IsChecked('CkOnline');
       
        if(Messenger.MyEmail != ""){
       
            WScript.RegWrite(MsgPlus.ScriptRegPath + Messenger.MyEmail + '\\useonline', online);
           
               
        }
       
        if(online == 1){
       
            FSO.CopyFile(Messenger.MyDisplayPicture, onlinedpfile);
         
        }else if(online == 0){
            FSO.CopyFile(onlinedefault, onlinedpfile);
        }
       
        onlinebool = online;
       
       
        PlusWnd.Close(1);
       
    }
}


//Picture changing function
function changepic(Stat){

      if(Stat == 2) {
             //Appear Offline
             Messenger.MyDisplayPicture = MsgPlus.ScriptFilesPath + "\\images\\offline.jpg";
      } else if(Stat == 4) {
             //Busy
             Messenger.MyDisplayPicture = MsgPlus.ScriptFilesPath + "\\images\\busy.jpg";
      } else if(Stat == 5) {
             //Be Right Back
             Messenger.MyDisplayPicture = MsgPlus.ScriptFilesPath + "\\images\\brb.jpg";
      } else if(Stat == 6) {
             //Idle
             Messenger.MyDisplayPicture = MsgPlus.ScriptFilesPath + "\\images\\idle.jpg";
      } else if(Stat == 7) {
             //Away
             Messenger.MyDisplayPicture = MsgPlus.ScriptFilesPath + "\\images\\away.jpg";
      } else if(Stat == 8) {
             //In a Call
             Messenger.MyDisplayPicture = MsgPlus.ScriptFilesPath + "\\images\\onphone.jpg";
      } else if(Stat == 9) {
             //Out to Lunch
             Messenger.MyDisplayPicture = MsgPlus.ScriptFilesPath + "\\images\\lunch.jpg";
      }
 
}

And now, here comes my question.
So how can I make the icon back to my "online" one?
Maybe some history work? Or etc?
I don't want it to be restricted..
I don't want to replace the image once again..
Please help.....
Thank you!!
10-19-2006 01:43 PM
Profile PM Find Quote Report
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: wanna edit this. Script - Simple Display Picture Changer by Equinox
All you need to do is change a couple of little things

code:
//On status change
function OnEvent_MyStatusChange(Stat) {

    changepic(Stat);
     
}
should simply become
code:
//On status change
function OnEvent_MyStatusChange(Stat) {
if (Messenger.MyStatus == 3){
new ActiveXObject('WScript.Shell').RegWrite(MsgPlus.ScriptRegPath+"DP",Messenger.MyDisplayPicture);
}
    changepic(Stat);
     
}

and in the last function just add another else if, this one being
code:
else if(Stat==3){
//Online
Messenger.MyDisplayPicture =
new ActiveXObject('WScript.Shell').RegRead(MsgPlus.ScriptRegPath+"DP");
}

To explain what this does - the first part just saves the location of your current DP to a registry key when you change from online, the second just changes you picture to the old online one when you change back to online. :cheesy:
[Image: markee.png]
10-19-2006 02:17 PM
Profile PM Find Quote Report
aaArcher_
New Member
*


Posts: 3
Joined: Oct 2006
O.P. RE: wanna edit this. Script - Simple Display Picture Changer by Equinox
I don't know why..
but it simply don't work?
It poped out a window and said..
There are mistakes in your script...
Something like that...
10-26-2006 12:44 PM
Profile PM Find Quote Report
Kenji
Veteran Member
*****

Avatar
Previously: Dazmatic, Dazzy, :zippy:

Posts: 1226
Reputation: 39
32 / Male / Flag
Joined: Jun 2006
Status: Away
RE: wanna edit this. Script - Simple Display Picture Changer by Equinox
quote:
Originally posted by Equinox
// If you have any questions or suggestions feel free
// to email me (Smilie)

Try emailing equinox with the email provided in the script :)
10-26-2006 12:48 PM
Profile 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