Best Practices for Script Writing
Moderators: Gurus, Addon Administrators
Best Practices for Script Writing
What are the best practices you'd recommend for writing scripts (currently using VBS) inside MediaMonkey?
I ask because the current process I'm using is:
1 - Write some code. Usually a single function/sub.
2 - Add to mmip file.
3 - Uninstall current add-on.
4 - Install new add-on (hopefully without error)
5 - Test newly written code to make sure it does what I was expecting. If not start again at step 1.
This means I'm stuck writing tiny junks of code and testing/validating every function/sub written every time it is written to ensure it isn't the one breaking the code. This gets very annoying when a function relies on another function and multiple functions/sub need to be written at once. I'm still new to vbs so tracking down the exact cause of an unknown error can be time consuming.
Is there a better way to do this?
Understand MediaMonkey is needed because many of the vbs language utilizes MM specific functions which are not available if I were to write it and test outside of MM.
Just wondering.
Thanks.
-Sterling
I ask because the current process I'm using is:
1 - Write some code. Usually a single function/sub.
2 - Add to mmip file.
3 - Uninstall current add-on.
4 - Install new add-on (hopefully without error)
5 - Test newly written code to make sure it does what I was expecting. If not start again at step 1.
This means I'm stuck writing tiny junks of code and testing/validating every function/sub written every time it is written to ensure it isn't the one breaking the code. This gets very annoying when a function relies on another function and multiple functions/sub need to be written at once. I'm still new to vbs so tracking down the exact cause of an unknown error can be time consuming.
Is there a better way to do this?
Understand MediaMonkey is needed because many of the vbs language utilizes MM specific functions which are not available if I were to write it and test outside of MM.
Just wondering.
Thanks.
-Sterling
Re: Best Practices for Script Writing
Hi,
There is no need for new MMIP and all other steps.
See https://www.mediamonkey.com/wiki/index. ... ol::Reload where you can put it as first line (Or at functions that you currently work on) and MM Will Always use latest VBS Version
eg.
You can see Last.Fm plugin.
There is no need for new MMIP and all other steps.
See https://www.mediamonkey.com/wiki/index. ... ol::Reload where you can put it as first line (Or at functions that you currently work on) and MM Will Always use latest VBS Version
eg.
Code: Select all
Script.Reload(Script.ScriptPath)
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Re: Best Practices for Script Writing
Thank you for the reply.
I've read that page. I'm assuming you have to put this inside your vbs script. Yes?
As per your reply, I've tried it. At the start of my script.
'''''''''''''''''''''''''' DEBUG '''''''''''''''''''''''''''''''''''''''
Script.Reload(Script.ScriptPath)
'''''''''''''''''''''''''' DEBUG '''''''''''''''''''''''''''''''''''''''
It is not inside a sub or function. Does it need to be in a sub? Which sub?
For those who don't read (understand) script documentation terminology/syntax is there an example to follow?
I really do appreciate the reply and I'm glad to hear there is a method to avoid all those steps. I just wish the documentation had more robust (or any) examples.
Thank you,
-Sterling
PS(To be clear this is not reloading the script.)
I've read that page. I'm assuming you have to put this inside your vbs script. Yes?
As per your reply, I've tried it. At the start of my script.
'''''''''''''''''''''''''' DEBUG '''''''''''''''''''''''''''''''''''''''
Script.Reload(Script.ScriptPath)
'''''''''''''''''''''''''' DEBUG '''''''''''''''''''''''''''''''''''''''
It is not inside a sub or function. Does it need to be in a sub? Which sub?
For those who don't read (understand) script documentation terminology/syntax is there an example to follow?
I really do appreciate the reply and I'm glad to hear there is a method to avoid all those steps. I just wish the documentation had more robust (or any) examples.
Thank you,
-Sterling
PS(To be clear this is not reloading the script.)
Re: Best Practices for Script Writing
Hi,
Yes Last.FM plugin uses it and from "!LastFM.Options.vbs" you can see why an dwhen is used:
Sent you PM to speed this up and we can post results here for future Scripters.
Yes Last.FM plugin uses it and from "!LastFM.Options.vbs" you can see why an dwhen is used:
Code: Select all
Sub InitSheet( Sheet)
Script.Reload(Script.ScriptPath) 'Script Reload on INIT Sheet so that updates can be checked
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Re: Best Practices for Script Writing
Thanks for the links on skype.
You mentioned the errors are occurring because objects aren't being used in the variables and so they are being wiped when the script is reloaded.
Since this looks like a complete rewrite of the base code is required, I'd rather not spend time using vbs for this since it wouldn't be usable for MM5.
I'd like to rewrite this in javascript. I just posted to the developer forum but will ask here as well.
Is there a sample javascript example showing how to get started? A "hello world" for javascript in MM?
The examples I'm using aasearch and lyricsearch are not very clear.
Thanks.
-Sterling
You mentioned the errors are occurring because objects aren't being used in the variables and so they are being wiped when the script is reloaded.
Since this looks like a complete rewrite of the base code is required, I'd rather not spend time using vbs for this since it wouldn't be usable for MM5.
I'd like to rewrite this in javascript. I just posted to the developer forum but will ask here as well.
Is there a sample javascript example showing how to get started? A "hello world" for javascript in MM?
The examples I'm using aasearch and lyricsearch are not very clear.
Thanks.
-Sterling
Re: Best Practices for Script Writing
Hi,
The best start would be to Extract MMIP plugins (RAR/7Zip) from MM5\SampleScripts folder and involved in MM5 Forum Part.
The best thing is that as MM5 is more actively developed you can influence what is added and needed.
The best start would be to Extract MMIP plugins (RAR/7Zip) from MM5\SampleScripts folder and involved in MM5 Forum Part.
The best thing is that as MM5 is more actively developed you can influence what is added and needed.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Re: Best Practices for Script Writing
Thank you. I didn't know that was there. I'll download MM5 and take a look.
It still would be nice to have these online as part of the documentation though.
Just a thought.
Thanks.
-Sterling
It still would be nice to have these online as part of the documentation though.
Just a thought.
Thanks.
-Sterling
Re: Best Practices for Script Writing
Hi,
There is see https://www.mediamonkey.com/forum/viewt ... 27&t=81285 you can also browse thru Dev forum.
There is see https://www.mediamonkey.com/forum/viewt ... 27&t=81285 you can also browse thru Dev forum.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Re: Best Practices for Script Writing
I stand corrected. Thanks. I guess I wasn't reading as clearly as I thought. I'll give it a shot now that I have examples and such to examine.
Appreciate the patience and replies.
-Sterling
Appreciate the patience and replies.
-Sterling
Re: Best Practices for Script Writing
Hi,
Sure, my pleasure. Please be patient with us as MM5 API is still in its infant staged where MMW API was expanded over 15 Years
Feel free to throw at us anything you miss or do not understand in MM5 Forums.
Sure, my pleasure. Please be patient with us as MM5 API is still in its infant staged where MMW API was expanded over 15 Years
Feel free to throw at us anything you miss or do not understand in MM5 Forums.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
How to attach PICTURE/SCREENSHOTS to forum posts