What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [split] show error toast instead of in debug window

Pages: (2): « First « 1 [ 2 ] Last »
[split] show error toast instead of in debug window
Author: Message:
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: [split] show error toast instead of in debug window
It might also work as expected if you specify the Debugger object as follows:

JScript code:
var Debugger = {
    "Start":    new Date,
    "Data":    new Array(),
    [...]
}

Note that you must separate each member with a comma, except for the last member:

JScript code:
var MyObject = {
    "SomeProperty":    "Hello world!", // used a comma here; if you omit it, a syntax error will be raised on this line
    "SomeMethod":    function(s) {
        Messenger.DisplayToast("",s); //this sign is within the function itself, so it'll work
    } // not used one here
      // if you put a semicolon (;) here, a syntax error will be raised

This post was edited on 06-11-2010 at 04:37 PM by SmokingCookie.
06-11-2010 04:35 PM
Profile PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: [split] show error toast instead of in debug window
Still returns the same error.  New code:
Spoiler:
js code:
var Debugger =
{
    "Start" : new Date(),
    "Data" : [],
    "Trace" : function(Text)
    {
        if (Messenger.MyStatus > 1)
        {
            try
            {
                if (Registry.Read("Options\\ChkDebug"))
                {
                    Debug.Trace(Text);
                    Debugger.Data.push(Text);
                }
            }
            catch (error)
            {
                Debug.Trace(Text);
                Debugger.Data.push(Text);
            }
        }
        else
        {
            Debug.Trace(Text);
            Debugger.Data.push(Text);
        }
    },
    "Call" : function(Function, Parameters)
    {
        var Notif = Function.substr(Function.length - 19, Function.length);
        if (Notif !== "MessageNotification" || (Notif === "MessageNotification" && Registry.Read("Options\\ChkDebugNotif")))
        {
            Debugger.Trace("=================================================================");
            Debugger.Trace("** Event called: " + Function + " **");
            Debugger.Trace("Call time: " + new Date());
            Debugger.Trace("-----------------------------------------------------------------");
            var Count = 0;
            for (var Parameter in Parameters)
            {
                Debugger.Trace("|| " + Parameter + ": " + Parameters[Parameter]);
                Count++;
            }
            if (Count === 0)
            {
                Debugger.Trace("(no attached parameters)");
            }
            Debugger.Trace("=================================================================");
        }
    },
    "Catch" : function(Function, Error)
    {
        Debugger.Trace("/////////////////////////////////////////////////////////////////");
        Debugger.Trace("** Error in: " + Function + " **");
        Debugger.Trace("Description: " + Error.description + " (" + Error.number + ")");
        Debugger.Trace("Error time: " + new Date());
        Debugger.Trace("/////////////////////////////////////////////////////////////////");
    },
    "Save" : function(Path)
    {
        var TextFile = FSO.CreateTextFile(Path, 2);
        TextFile.WriteLine("");
        TextFile.WriteLine("=================================================================");
        TextFile.WriteLine("**************** Interface Writer: Debugging Log ****************");
        TextFile.WriteLine("-----------------------------------------------------------------");
        TextFile.WriteLine("Start time: " + Debugger.Start);
        TextFile.WriteLine("=================================================================");
        TextFile.WriteLine("");
        for (var X in Debugger.Data)
        {
            TextFile.WriteLine(Debugger.Data[X]);
        }
        TextFile.WriteLine("");
        TextFile.WriteLine("=================================================================");
        TextFile.WriteLine("End time: " + new Date());
        TextFile.WriteLine("=================================================================");
        TextFile.Close();
    }
}
06-11-2010 07:19 PM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: [split] show error toast instead of in debug window
It might help if you could point us where line 72 is (or whatever line it was).

Here's something I noticed: you're using the name Function as parameter name, which may conflict with the JScript's built-in Function class. I suggest you change the name of the parameter (and its references).

Also, where are you defining FSO?
js code:
    "Save" : function(Path)
    {
        var TextFile = FSO.CreateTextFile(Path, 2);
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
06-12-2010 07:25 AM
Profile E-Mail PM Web Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: [split] show error toast instead of in debug window
Line 72 is the call to Debugger::Catch.
js code:
Debugger.Catch("Initialize", error);

FSO is defined globally, in a file called "VarGlobals.js".
js code:
var FSO = new ActiveXObject("Scripting.FileSystemObject");

I've changed the variable name to "Fn", but it doesn't seem to make a difference.



Edit: fixed it!  I synced all my files with a backup tool of mine, but it overwrote a file which had an old copy of the Debug stuff, meaning the new Debug object was being cleared and filled with the old tools.  :|  Thanks, anyway.  ;)

This post was edited on 06-12-2010 at 11:31 AM by whiz.
06-12-2010 11:30 AM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: [split] show error toast instead of in debug window
Omg you just gave me a great idea :O

[Image: attachment.php?pid=995568]

(click to enlarge)

.png File Attachment: Console.png (85.52 KB)
This file has been downloaded 254 time(s).

This post was edited on 06-13-2010 at 02:02 PM by Tochjo.
06-12-2010 05:14 PM
Profile PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: [split] show error toast instead of in debug window
Yeah, the evaluator can be useful for testing code snippets.  Maybe I'll put a file reader in as well...  ;)
06-13-2010 10:14 AM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: [split] show error toast instead of in debug window
Well, I was actually talking about the other window :P

About the eval window: just be extremely careful with this, as any code can be evaluated during runtime, and if WLM crashes, you might not be able to figure out what's wrong.

This post was edited on 06-13-2010 at 10:30 AM by SmokingCookie.
06-13-2010 10:28 AM
Profile PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: [split] show error toast instead of in debug window
Fair enough.  :)
06-13-2010 01:12 PM
Profile E-Mail PM Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« 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