Shoutbox

why my scripts can not work? - 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: why my scripts can not work? (/showthread.php?tid=65041)

why my scripts can not work? by Hijhon on 08-17-2006 at 01:23 PM

quote:
var txtFilepath;
var refreshtime;

function OnEvent_Initialize(MessengerStart)           //开始登陆后执行
{
    txtFilepath = MsgPlus.ScriptFilesPath + "\\" + "song.txt";
    refreshtime = 2000;
    loadtext();
    OnEvent_Timer(ChangeTime);
}


function OnEvent_Timer(TimerId){                      //时间触发器
if(TimerId == "ChangeTimer") {
         Messenger.MyPersonalMessage = txtline[i];
        MsgPlus.AddTimer("ChangeTimer", refreshtime);
        A++;
        if (A==i)
        {
            loadtext()
        }
}
}

function OnEvent_Uninitialize(MessengerExit)
{
   // 清理内存
   Shell = null;
   FileSystem = null;
   Settings = [];
}

function loadtext()  //读取文本内容
{
    var shell
    var filesystem
    var txtfile
    var txtline
    var i = 0;
    var error = false;
    Shell = new ActiveXObject("WScript.Shell");
    FSO = new ActiveXObject("Scripting.FileSystemObject");
    txtFile = FSO.OpenTextFile(Settings['txtFilepath']);
    if(!error) {
        do {
            txtline[i] = txtfile.ReadLine();
            i++;
        }while(!error);
        NameFile.Close();
    }

}

RE: why my scripts can not work? by ShawnZ on 08-17-2006 at 01:25 PM

it always helps when you tell us whats wrong with it


RE: why my scripts can not work? by markee on 08-17-2006 at 01:30 PM

For starters "i" needs to be a global variable to be able to be used in multiple functions (placed outside of a function).  shell and filesystem are made valid variables and not used while var isn't put infront of Shell and FSO when they are being defined.  They were some problems I noticed quickly.  You may also want to refer to your syntax error in the script debugging window to understand where mistakes have been made (it would also pay to tell use what the error says there so we can have more understanding at a quicker look).


RE: why my scripts can not work? by Hijhon on 08-17-2006 at 01:32 PM

nothing display when I run this script.
I do not know whats wrong with it,PLZ help me.
I am newbie!
thanks!!


RE: why my scripts can not work? by Matti on 08-17-2006 at 03:49 PM

Make sure that the checkbox "Enable debugging options" in the Scripts tab of the General section in the Plus! Live preferences window is checked and then try to add

code:
Debug.DebuggingWindowVisible = true;
on the first line of your script to open the debugging window. Select your scripts name in the dropdownlist and then copy the contents of the textbox and paste them here, so we can see what's really going on with it. :)
RE: why my scripts can not work? by Hijhon on 08-18-2006 at 04:26 AM

Ok,I try it,thanks!