Beginner question about debugging scripts

To discuss development of addons / skins / customization of MediaMonkey.

Moderators: jiri, drakinite, Addon Administrators

mms1234

Beginner question about debugging scripts

Post by mms1234 »

Hi everyone, I've been a mediamonkey 4 user for a while and have a couple VBScripts scripts that I am trying to convert to media monkey 5 javascripts. Right now I am just starting with the basics, I have created an action, and a menu entry for it. I can launch a dialog window from there. Next step is to loop through the selected tracks, and popup a dialog window with the title for each track. But for some reason my script is dying and I can't figure out why. I have read the documentation, but I am still completely confused as to how to enter development mode and bring up a console or debugger. I have tried:

1) Hitting ctrl-alt-shift
2) right clicking anywhere (as the doc says) to bring up menu option
3) open Help->About menu
4) putting app.enabledDeveloperMode = true in my code

None of these seem to do anything, and I am struggling to find any documentation on how to go about debugging scripts in MM5. I would appreciate any pointers.
Also, is it standard practice to have to restart MM everytime you change a script?
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: Beginner question about debugging scripts

Post by drakinite »

Hi, welcome to MM addon development!

- To use the Ctrl + Alt + Shift shortcut, and to get the "Inspect Element" menu item, you need to install a debug build from the test builds thread: https://www.mediamonkey.com/forum/viewt ... 86639&sd=d
- However, on a non-debug build, you can still open the debug console. In a browser window, navigate to http://localhost:9222. To inspect the main window, click on mainwindow.html.
- All the "Developer mode" toggle does is disable the automatic sending of crash logs. (It's certainly useful, but won't let you view the console.)

Re restarting MM: The short answer is yes, but there's a long answer:
- Any code that runs in the main window, like in actions_add.js, or if you define new controls in controls/(filename).js, will require you to restart MediaMonkey when you change it.
- However, code that defines dialogs is automatically reloaded every time the dialog window opens. So if you change dialogs/myDialog.js or dialogs/myDialog.html, your changes will take effect the next time you open the dialog.
- However however, the above statement does not hold for code in separate scripts, such as controls. Let's say you create a control called colorPicker (assume colorPicker doesn't already exist in MM) in controls/colorPicker.js, and you're calling it from your dialog. If you make changes to controls/colorPicker.js, the changes won't take effect because those scripts are cached.
If you don't already have Refresh Skin Shortcut installed, I'd recommend it: https://www.mediamonkey.com/addons/brow ... -shortcut/
By default, clicking the button will refresh LESS (skin files). But if you right click the button, you can do a full window reload. You can change its default behavior by opening its settings panel in Tools > Addons.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
mms1234

Re: Beginner question about debugging scripts

Post by mms1234 »

thank you so much, this was very informative. I was missing the part about how to connect MediaMonkey to chrome, I thought developer mode did that. But now I see how that's done. Very cool to be able to debug that way. I've got a lot to catch up on, now I am atleast over the next hurdle. :)

thanks again!
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: Beginner question about debugging scripts

Post by drakinite »

No problem! Feel free to leave a reply or PM if you have more questions.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
spiky
Posts: 10
Joined: Tue Dec 13, 2016 7:24 pm

Turn on Developer Mode

Post by spiky »

Hi! can anyone clarify the instructions for switching on Developer Mode in MM5?

The documentation says "please turn on Developer Mode under Help -> About", but there is no such option under Help -> About. It just displays the "about" page, and that's all. No options of any kind, about anything at all, except you can click to see the license.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: Turn on Developer Mode

Post by drakinite »

spiky wrote: Sun Mar 20, 2022 10:56 am Hi! can anyone clarify the instructions for switching on Developer Mode in MM5?

The documentation says "please turn on Developer Mode under Help -> About", but there is no such option under Help -> About. It just displays the "about" page, and that's all. No options of any kind, about anything at all, except you can click to see the license.
Hi,
I've merged this topic with another which contains a detailed answer to your question. :slight_smile: TL;DR: Install a debug build.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
Post Reply