Script debugging
All  1-3  4-6

Previous
Next
 From:  Michael Gibson
8264.4 In reply to 8264.1 
Some excellent tips from Brian above, thanks Brian!

For getting information about what's going on you put in moi.ui.alert( 'text' ); to pop up an alert dialog. If you need to spew out a bunch more information you can instead use moi.log( 'text' ); which will put the text into MoI's text log instead of popping up a dialog, then the whole log can be shown with a shortcut key with script:moi.ui.createDialog( 'ShowLog.htm' );

And that's about it currently... Definitely doing things in an incremental way like Brian describes helps a lot. In the future I would like to work on making it easier to do this with some kind of integrated script debugger where you could set breakpoints and view variable values and things like that, but I won't know how much work is involved until I dig into it some.

@Brian, re:
> Script in the .htm file lacks "debug" help, and may not work for "peculiar reasons", so it
> is better to script in the .js file, and later move it to .htm script section for speed, if needed.

One of the things that I've changed with v4 is that the script from the .js file will now be run directly in the main thread instead of in a separate moi_commandprocessor.exe process, so there won't be any speed penalty for the .js code anymore. The down side of this though is that it will be easier to lock up MoI if the script goes into an infinite loop or something but that will already happen anyway with code run on the .htm side of things.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
8264.5 In reply to 8264.4 
Thank you Michael for the information.

I've added a new shortcut key inside MoI, Options, Shortcut keys, with your shortcut key script for ShowLog.

Good news on the .js "speedup".

When I write bad code which causes a lockup when testing a new script in MoI, I press CtrlAltDelete, hit "Start Task Manager,"
to bring up Windows 7 Task Manager, and under Applications, highlight MoI, and hit End Task. This closes MoI, ending the lockup.
(I don't think good code causes such lockups...AFAIK)

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  dan (DANLANIGAN)
8264.6 
Brian,

Thanks for your many tips, some I was aware of but others not. I'll see how much of this I can incorporate into my own workflows.

Michael,

I was aware of the ui.alert method but not the log, I'll see how I can use this to my advantage going forward, thanks.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
 
Show messages: All  1-3  4-6