What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [HELP] I need some help with my script

[HELP] I need some help with my script
Author: Message:
Otacon
New Member
*


Posts: 11
Joined: Oct 2008
O.P. [HELP] I need some help with my script
OK, I made a script which reads text from a .txt file(amipOutput.txt) and sets it as my PM. In case that file is empty, it reads another file(PM.txt). And sets the text inside that as my PM. The script is working perfectly except for one thing: after some time of running, i get a "End of file" error in the debugger and the script stops. Here's my code:

quote:
var y = 0;
function OnEvent_Initialize(MessengerStart)
{
    addTimer();
}
function addTimer()
{
    MsgPlus.AddTimer("pm",1000);
}
function OnEvent_Timer(pm)
{
    if(y == 0)
    {
        var fso1, f, s;
        fso1 = new ActiveXObject("Scripting.FileSystemObject");
        f = fso1.GetFile("C:\\amipOutput.txt");
        s = f.size;
       
        if(s == 0)
        {
            setPm();
            addTimer();
        }
        else
        {
            setAmip();
            addTimer();
        }
       
    }
}
function setPm()
{
    var fso, ts, a, a1, f1, txt;
    var ForReading = 1;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    ts = fso.OpenTextFile("C:\\PM.txt",ForReading);
    a = ts.ReadAll();
    ts.Close();
    a = MsgPlus.RemoveFormatCodes(a);
    Messenger.MyPersonalMessage = a;
    a = 0;
}
function setAmip()
{
    var fso2, ts2, b, b1, f1, txt;
    var ForReading = 1;
    fso2 = new ActiveXObject("Scripting.FileSystemObject");
    ts2 = fso2.OpenTextFile("C:\\amipOutput.txt",ForReading);
    b = ts2.ReadAll();
    ts2.Close();
    b = MsgPlus.RemoveFormatCodes(b);
    Messenger.MyPersonalMessage = b;
    b = 0;
}
function OnEvent_MenuClicked(sMenuId, sLoc, sWnd)
{
    if(sMenuId=="on")
    {
        addTimer();
        var y = 0;
    }
    if(sMenuId=="off")
    {
        var y = 1;
        MsgPlus.CancelTimer("pm");
        setPm();
    }
}


function OnGetScriptMenu()
{

    var myMenu = new PlusMenu;
   
    myMenu.addItem("on", "Turn AMIP PM on");
    myMenu.addItem("off", "Turn AMIP PM off");
   
    return myMenu.build();
}

Please, it's driving me crazy, I want to finally get it to work.
10-12-2008 02:18 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[HELP] I need some help with my script - by Otacon on 10-12-2008 at 02:18 PM
RE: [HELP] I need some help with my script - by Jonte135 on 10-18-2008 at 03:52 PM
RE: [HELP] I need some help with my script - by Matti on 10-18-2008 at 04:05 PM
RE: [HELP] I need some help with my script - by Otacon on 10-18-2008 at 04:14 PM
RE: [HELP] I need some help with my script - by Matti on 10-18-2008 at 04:19 PM
RE: [HELP] I need some help with my script - by Otacon on 10-18-2008 at 06:14 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