What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » DevPlus - script testing/debug add-on...

DevPlus - script testing/debug add-on...
Author: Message:
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: DevPlus - script testing/debug add-on...
quote:
Originally posted by Matti
quote:
Originally posted by whiz
I'm considering adding a kind of variable lookup option, so you can enter a global variable name, and it'll give you an output of what it is (like print_r in PHP)
Good luck with that. I haven't found a proper method to retrieve or modify the global scope so far, I'd like to see what you come up with. In JavaScript (in a browser), you have the window object which contains the global scope but there's no such thing in JScript (as an application script).
Would it be possible to use eval (probably not the best method, but I don't see much else that can be used here):
js code:
var foo = 3; // declared globally

/* inside variable lookup events */
var variable = "foo"; // variable name as collected from user
var type = eval("typeof(" + variable + ")");
var value = eval(variable);
switch (type)
{
    case "undefined":
        return false; // does not exist
    case "string":
    case "number":
    case "boolean":
        return type + "|" + value; // just return value
    case "object":
        // iterate through properties, etc.
}
Of course, wouldn't use local variables here, since if they were searched for, then the local values would be returned.

Edit: have got this working, it seems, using a try/catch for if it exists or not.
Edit (again): it's got some object iteration too.  Here's an example:
js code:
[true, "hello", [1, 2, 3], 4, null]
code:
Type: object

[0] => (boolean) true
[1] => (string) hello
[2] => object...
--> [0] => (number) 1
--> [1] => (number) 2
--> [2] => (number) 3
[3] => (number) 4
[4] => null

quote:
Originally posted by Matti
quote:
Originally posted by whiz
and maybe some sort of window monitor (but this will need me to extend the MsgPlus::CreateWnd function - can this be done?).
I seriously doubt it. Plus! objects (MsgPlus, Messenger, PlusWnd,...) aren't regular objects, they're interfaces. They don't have a prototype  or constructor as regular JScript objects have.
I guess it could be done by adding calls to a DevPlus function when creating a window, but that's kinda messy (the whole point of this is that you just add the files without having to modify a script to support the debugging stuff...).  I'll have to see what I can come up with.

This post was edited on 08-03-2011 at 02:37 PM by whiz.
08-03-2011 01:07 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
DevPlus - script testing/debug add-on... - by whiz on 06-07-2011 at 08:24 AM
RE: DevPlus - script testing/debug add-on... - by matty on 06-07-2011 at 04:45 PM
RE: DevPlus - script testing/debug add-on... - by whiz on 08-02-2011 at 07:05 PM
RE: DevPlus - script testing/debug add-on... - by Matti on 08-03-2011 at 09:02 AM
RE: DevPlus - script testing/debug add-on... - by whiz on 08-03-2011 at 01:07 PM
RE: DevPlus - script testing/debug add-on... - by whiz on 08-22-2011 at 07:03 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