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.