Shoutbox

wanna edit this. Script - Simple Display Picture Changer by Equinox - 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: Scripting (/forumdisplay.php?fid=39)
+----- Thread: wanna edit this. Script - Simple Display Picture Changer by Equinox (/showthread.php?tid=67468)

wanna edit this. Script - Simple Display Picture Changer by Equinox by aaArcher_ on 10-19-2006 at 01:43 PM

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!!
RE: wanna edit this. Script - Simple Display Picture Changer by Equinox by markee on 10-19-2006 at 02:17 PM

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:

RE: wanna edit this. Script - Simple Display Picture Changer by Equinox by aaArcher_ on 10-26-2006 at 12:44 PM

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...


RE: wanna edit this. Script - Simple Display Picture Changer by Equinox by Kenji on 10-26-2006 at 12:48 PM

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 :)