What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » My script gets auto-disabled on logout, Any help?

My script gets auto-disabled on logout, Any help?
Author: Message:
apex
Junior Member
**


Posts: 20
Joined: Mar 2008
O.P. My script gets auto-disabled on logout, Any help?
Hey all,  I have this script, for PSM Chat, but when i log out, msg plus disables it. Auto, wich sucks.

So does any1 knows where the bug is ?
Here is the script:

code:
var d = new Date();
time = d.getMonth() + 1;
oldpsm = "";
isxmason = "0";
test = "";


function OnEvent_Uninitialize(MessengerExit)
{
}

function OnEvent_Initialize(MessengerStart)
{
    TurnOn();
    var test="";
    oldpsm = Messenger.MyPersonalMessage;
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",1);
    filecontents = filehandle.ReadAll();
    checkpsm = filecontents.split("[currentpsm]")[1].split("[/currentpsm]")[0];
    filehandle.close();
    if (oldpsm == checkpsm){
        Messenger.MyPersonalMessage = checkpsm;
    } else if (oldpsm != checkpsm && checkpsm != "") {
        msgbox("Je huidige PSM komt niet overeen met de laatst opgeslagen PSM, Ga alstublieft naar PSM Instellingen om dit te verhelpen.\nAls je dit niet verhelpt, kan PSM Chat mogelijk niet goed werken.");
    } else {
        var fso = new ActiveXObject("Scripting.FileSystemObject");
        filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",2);
        data = "[currentpsm]" + Messenger.MyPersonalMessage + "[/currentpsm]";
        filehandle.Write(data);
        msgbox("PSM Chat is ingesteld..\n\nThis bericht zou niet nog eens moeten verschijnen, neem anders contact op met de scriptor.");
        filehandle.close();
    }
}

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MessageKind)
{
    if (test == "on")
    {
        var name = MsgPlus.RemoveFormatCodes(Origin.substring(0,25));
        if (name == Messenger.Myname) {
            if(Message.substring(0,1) == "~") {
                damessage = Message.substring(1,500);
                ChatWnd.SendMessage("");
            }
        } else {
            if(Message.substring(0,1) == "~") {
                damessage = Message.substring(1,500);
                Messenger.MyPersonalMessage = "" + name + " zegt: " + damessage + "  - Jou berichtje hier?Typ een ~ voor je berichtje!";
                ChatWnd.SendMessage(" Je berichtje:  " + "" + damessage + "" + "  staat erin! ;-)" );
                MsgPlus.DisplayToast("PSM Chat","PSM veranderd in: " + damessage + ".");
            }
        }
    }
}




And:
code:
oldpsm=Messenger.MyPersonalMessage;
var fso = new ActiveXObject("Scripting.FileSystemObject");
filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",1);
filecontents = filehandle.ReadAll();
oldpsm = filecontents.split("[currentpsm]")[1].split("[/currentpsm]")[0];
filehandle.close();
function OnGetScriptMenu(Location)
{
    if (Location == 1 || Location == 2)
    {
        var ScriptMenu = "<ScriptMenu>";
        ScriptMenu += "<MenuEntry Id=\"MnuOn\">Aanzetten</MenuEntry>";
        ScriptMenu += "<MenuEntry Id=\"MnuOff\">Uitzetten</MenuEntry>";
        ScriptMenu += "<Separator/>";
        ScriptMenu += "<MenuEntry Id=\"MnuReset\">Reset</MenuEntry>";
        ScriptMenu += "<Separator/>";
        ScriptMenu += "<MenuEntry Id=\"MnuConf\">Instellingen</MenuEntry>";
        ScriptMenu += "<MenuEntry Id=\"MnuAbout\">Over</MenuEntry>";
        ScriptMenu += "</ScriptMenu>";
        return ScriptMenu;
    }
}

function OnEvent_MenuClicked(Id, Location, OrgWnd)
{
    if (Id == "MnuOn")
        TurnOn();
    if (Id == "MnuOff")
        TurnOff();
    if (Id == "MnuReset")
        Reset();
    if (Id == "MnuConf")
        Conf();
    if (Id == "MnuAbout")
        About();
}

function About()
{
    MsgPlus.CreateWnd("dialogues.xml", "About");
}

function msgbox(msg)
{
    Interop.Call("User32.dll", "MessageBoxW", 0,msg,"PSM Chat", 0);
}

function Conf()
{
    var Wnd = MsgPlus.CreateWnd("dialogues.xml", "Conf");
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",1);
    filecontents = filehandle.ReadAll();
    oldpsm = filecontents.split("[currentpsm]")[1].split("[/currentpsm]")[0];
    filehandle.close();
    thecurrentpsm = oldpsm;
    Wnd.SetControlText("curpsm",thecurrentpsm);
}

function Reset()
{
    if(test == "on") {
        Messenger.MyPersonalMessage = "Mijn PSM chat staat aan, vraag me hoe het werkt!";
        MsgPlus.DisplayToast("PSM Chat","Reset");
    } else if(test == "off") {
        var fso = new ActiveXObject("Scripting.FileSystemObject");
        filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",1);
        filecontents = filehandle.ReadAll();
        oldpsm = filecontents.split("[currentpsm]")[1].split("[/currentpsm]")[0];
        filehandle.close();
        Messenger.MyPersonalMessage = oldpsm;
        MsgPlus.DisplayToast("PSM Chat","Reset");
    } else if(test == "") {
        var fso = new ActiveXObject("Scripting.FileSystemObject");
        filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",1);
        filecontents = filehandle.ReadAll();
        oldpsm = filecontents.split("[currentpsm]")[1].split("[/currentpsm]")[0];
        filehandle.close();
        Messenger.MyPersonalMessage = oldpsm;
        MsgPlus.DisplayToast("PSM Chat","NOT RUNNING.");
    }
}

function Refresh()
{
    if(test == "on") {
        Messenger.MyPersonalMessage = "Jou berichtje hier? Typ: ~ plus je berichtje!";
    } else if(test == "off" || test == "") {
        var fso = new ActiveXObject("Scripting.FileSystemObject");
        filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",1);
        filecontents = filehandle.ReadAll();
        oldpsm = filecontents.split("[currentpsm]")[1].split("[/currentpsm]")[0];
        filehandle.close();
        Messenger.MyPersonalMessage = oldpsm;
    }
}

function TurnOn()
{
    test = "on";
    MsgPlus.DisplayToast("PSM by Jules Huls","Status is: " + test + ".");
    Messenger.MyPersonalMessage = "Jou berichtje hier? Typ: ~<bericht>";
}

function TurnOff()
{
    test = "off";
    MsgPlus.DisplayToast("PSM by Jules Huls","Status is: " + test + ".");
    Messenger.MyPersonalMessage = oldpsm;
}

function OnConfEvent_CtrlClicked(PlusWnd,ControlId) {
    if (ControlId == "BtnSave") {
        var fso = new ActiveXObject("Scripting.FileSystemObject");
        filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",2);
        thenewpsm = PlusWnd.GetControlText("newpsm2");
        data = "[currentpsm]" + thenewpsm + "[/currentpsm]";
        filehandle.Write(data);
        msgbox("Je nieuwe PSM is opgeslagen.");
        filehandle.close();
        var fso = new ActiveXObject("Scripting.FileSystemObject");
        filehandle = fso.OpenTextFile(MsgPlus.ScriptFilesPath+"\\Config.ini",1);
        filecontents = filehandle.ReadAll();
        thecurrentpsm = filecontents.split("[currentpsm]")[1].split("[/currentpsm]")[0];
        filehandle.close();
        PlusWnd.SetControlText("curpsm",thecurrentpsm);
        PlusWnd.SetControlText("newpsm2","");
        Refresh();
    }
}



Yes, i know it can be a simple thing, im just starting to create scripts, but this ain't mine, and the scriptor stopped, and i can't figure it out.



~Apex
04-01-2008 06:01 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
My script gets auto-disabled on logout, Any help? - by apex on 04-01-2008 at 06:01 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