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. Roll Eyes  DevPlus - script testing/debug add-on...
A little something I wrote to help me with testing certain things in scripts.

The ZIP folder has two files - DevPlus.js and DevPlus.xml.  Place both files in the root of the script you want to use it with, then reload the script.  A toolbar will appear in the top-right corner of the screen.

This is not a script!  Although it works on its own, it won't do much - you add it to your own script (but take it out when publishing scripts).

[Image: kBUw0.png]

From left to right: test script menu, test menu click, view script commands, test sent messages, toggle script debug, code evaluator.

If a button's not enabled, then you haven't got the corresponding function declared in your script (e.g. the first button requires OnGetScriptMenu() to be declared).

You can control how DevPlus starts.  At the bottom of the script file is the line DevPlus.Start().  By default, this will start DevPlus with Messenger.  You can change this by moving the line elsewhere (for example, triggered by a menu click or command, or just to startup using OnEvent_SigninReady() instead.

Bug, glitch, suggestion or problem?  Report here!  :)

Current version: 1.01

.zip File Attachment: DevPlus.zip (5.58 KB)
This file has been downloaded 220 time(s).

This post was edited on 06-08-2011 at 07:46 PM by whiz.
06-07-2011 08:24 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: DevPlus - script testing/debug add-on...
Interesting, this is a very good concept. I am curious of other features you could add to it.
06-07-2011 04:45 PM
Profile E-Mail PM Find Quote Report
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: DevPlus - script testing/debug add-on...
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), and maybe some sort of window monitor (but this will need me to extend the MsgPlus::CreateWnd function - can this be done?).  Any other suggestions welcome.
08-02-2011 07:05 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: DevPlus - script testing/debug add-on...
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).
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.
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
08-03-2011 09:02 AM
Profile E-Mail PM Web Find Quote Report
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):
Javascript 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:
Javascript 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
whiz
Senior Member
****


Posts: 568
Reputation: 8
– / – / Flag
Joined: Nov 2008
O.P. RE: DevPlus - script testing/debug add-on...
I've noticed a potential issue with the script file...

Plus! loads files in alphabetical order, and, assuming you have DevPlus set-up as default to show as soon as the file is loaded, it checks for the existance of menu/command event handlers straight away.  So if they're in a file that comes alphabetically after DevPlus, they won't get detected.

The way round this is to rename the DevPlus file to something with a load of Z's at the start (or a NBSP, as I'm using), to ensure it loads last.  Or, you could just move the Start() function line to the initialize function of your script.  But yeah, otherwise it's not a problem...
08-22-2011 07:03 PM
Profile E-Mail PM Find Quote Report
« 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