Porting scripts for MM 4.0

Post a reply

Visual Confirmation

To prevent automated access and spam, you are required to confirm that you are human. Please place a check mark next to all images of monkeys or apes. If you cannot see any images, please contact the Board Administrator.

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Topic review
   

Expand view Topic review: Porting scripts for MM 4.0

Re: Porting scripts for MM 4.0

Post by Psyker7 » Mon Mar 28, 2011 7:28 am

In terms of creating files to be used by the script, is it better to use Script.ScriptPath or %appdata%\mediamonkey?

I just went and re-wrote my script to use %appdata% to now discover MM4 can install scripts to %appdata% now.

Given I would prefer it to be compatible with MM3 & 4, I'm thinking using %appdata% is the best option for now...

Re: Porting scripts for MM 4.0

Post by Eyal » Mon Jan 31, 2011 9:59 am

Thank you.

Re: Porting scripts for MM 4.0

Post by Ludek » Mon Jan 31, 2011 8:20 am

Eyal wrote:- I'm running Windows XP, MM 3.2.4.
- I upgrade MM3 by installing MM4 in same folder. The folder already contained scripts in \Program Files\Mediamonkey\Scripts\Auto,
with my new script in it. So far so good. The script is working.
- I made some changes to my script, rebuilt the mmip and install it. The script now seems to run twice (?)


Thanks, fixed as http://www.ventismedia.com/mantis/view.php?id=7273

Re: Porting scripts for MM 4.0

Post by ZvezdanD » Mon Jan 31, 2011 2:59 am

Eyal wrote:I think {app}\ should install in application folder. {usr}\ or another variable name might be used to install into local folder.

I don't think so. If you introduce something like that, none existing installer package would be compatible with MM4. During installation of the new version of script/skin, the program itself should uninstall the old version of the same script/skin, not matter if it is previously installed in local or global folder and not matter of the current user choice of the installation folder.

I am going to report that in Mantis: Uninstall of old version of scripts/skins during installation of new version doesn't work always.

Re: Porting scripts for MM 4.0

Post by rovingcowboy » Sun Jan 30, 2011 6:10 am

Eyal wrote:
jiri wrote:I added a small Wiki section that describes changes that might be needed for some scripts, it's here:

Making scripts ready for per-user installations
Starting from MediaMonkey 4.0, scripts can be (and are suggested to be) installed per-user, and so they don't have to be installed in Program Files folder, but are installed in local Windows folders. The mechanism in MM is internally make as transparent as possible, so that scripts don't have to care much about their installed location. That said, some pre-4.0 scripts might need tweaking. For example, a popular script Lyricator has >1000 lines, but there's only one change needed in order to get it working under local installation, namely:

Dim sAppPath: sAppPath = sdb.ApplicationPath & "Scripts\Lyricator\"needs to be changed to

Dim sAppPath: sAppPath = sdb.ScriptsPath & "Lyricator\"


Hi,

I finally found why I had hard time debugging my new script under MM4!

- I'm running Windows XP, MM 3.2.4.
- I upgrade MM3 by installing MM4 in same folder. The folder already contained scripts in \Program Files\Mediamonkey\Scripts\Auto,
with my new script in it. So far so good. The scripts is working.
- I made some changes to my script, rebuilt the mmip and install it. The script now seems to run twice (?)

Reason: New mmip installation put the script in C:\Documents and Settings\Eyal\Application Data\MediaMonkey\Scripts\Auto, instead of overwriting the old one. So after restarting MM, 2 versions of the script are running simultaneously.

Here's the mmip:
Code: Select all
[Header]
ID=PlayedDateAndCounter
Title=Played Date & Counter
Description=Sets Played Date and Counter on playback startup
VersionMajor=1
VersionMinor=0
Type=Script

[Copy]
Src=PlayedDateAndCounter.vbs
Tgt={app}\Scripts\Auto\PlayedDateAndCounter.vbs

[Execute]
File={app}\Scripts\Auto\PlayedDateAndCounter.vbs
Function=OnStartup

I think {app}\ should install in application folder. {usr}\ or another variable name might be used to install local folder.

Is that what you meant by "The mechanism in MM is internally make as transparent as possible, so that scripts don't have to care much about their installed location." ?

Thanks

Eyal :~)



hey eyal for my skin mmip i just tried to get updated it put the skin name in the skins choice window twice you might have found the answer for me i'll look in that other place on mine for the extra skin.

Re: Porting scripts for MM 4.0

Post by Eyal » Sun Jan 30, 2011 4:18 am

jiri wrote:I added a small Wiki section that describes changes that might be needed for some scripts, it's here:

Making scripts ready for per-user installations
Starting from MediaMonkey 4.0, scripts can be (and are suggested to be) installed per-user, and so they don't have to be installed in Program Files folder, but are installed in local Windows folders. The mechanism in MM is internally make as transparent as possible, so that scripts don't have to care much about their installed location. That said, some pre-4.0 scripts might need tweaking. For example, a popular script Lyricator has >1000 lines, but there's only one change needed in order to get it working under local installation, namely:

Dim sAppPath: sAppPath = sdb.ApplicationPath & "Scripts\Lyricator\"needs to be changed to

Dim sAppPath: sAppPath = sdb.ScriptsPath & "Lyricator\"


Hi,

I finally found why I had hard time debugging my new script under MM4!

- I'm running Windows XP, MM 3.2.4.
- I upgrade MM3 by installing MM4 in same folder. The folder already contained scripts in \Program Files\Mediamonkey\Scripts\Auto,
with my new script in it. So far so good. The script is working.
- I made some changes to my script, rebuilt the mmip and install it. The script now seems to run twice (?)

Reason: New mmip installation put the script in C:\Documents and Settings\Eyal\Application Data\MediaMonkey\Scripts\Auto, instead of overwriting the old one. So after restarting MM, 2 versions of the script are running simultaneously.

Here's the mmip:
Code: Select all
[Header]
ID=PlayedDateAndCounter
Title=Played Date & Counter
Description=Sets Played Date and Counter on playback startup
VersionMajor=1
VersionMinor=0
Type=Script

[Copy]
Src=PlayedDateAndCounter.vbs
Tgt={app}\Scripts\Auto\PlayedDateAndCounter.vbs

[Execute]
File={app}\Scripts\Auto\PlayedDateAndCounter.vbs
Function=OnStartup

I think {app}\ should install in application folder. {usr}\ or another variable name might be used to install into local folder.

Is that what you meant by "The mechanism in MM is internally make as transparent as possible, so that scripts don't have to care much about their installed location." ?

Thanks

Eyal :~)

Re: Porting scripts for MM 4.0

Post by ZvezdanD » Sun Jan 16, 2011 7:37 pm

ZvezdanD wrote:5. some Web Browser controls are not displayed at all (Magic Nodes and RegExp scripts are affected); I am trying to find some solution, but I am afraid that this could be resolved only in the program itself.

I have found a reason for that and reported in Mantis: Second Web Browser control on form has serious problem with Common.Anchors property [4.x]

Re: Porting scripts for MM 4.0

Post by ZvezdanD » Sun Jan 16, 2011 4:09 am

Peke wrote:re 1. tracked and tested within http://www.ventismedia.com/mantis/view.php?id=7084

I am sorry, but your description in that report was not very clear to me. Beside of that, you are mentioning only change of PlayCount, but forgot to mention LastPlayed. And why you put that issue in Last.fm plugin Project when it could have some side effect with any script?

Re: Porting scripts for MM 4.0

Post by Peke » Sat Jan 15, 2011 8:45 pm

Re: Porting scripts for MM 4.0

Post by ZvezdanD » Sat Jan 15, 2011 4:49 am

Well, it is not enough to change only that. Here are some differences which I have discovered that could stop executing some scripts:
1. When track finish with reproduction with MM 3.x we had OnTrackProperties event , then OnTrackEnd, then OnPlaybackEnd; with 4.0 we have OnTrackEnd, then OnPlaybackEnd, then OnTrackProperties instead;

2. If you set SDBSongData.PlayCounter = 0, with MM3 SDBSongData.LastPlayed stays unchanged, but with MM4 it is set to 0 as well;

3. Setting SDB.MainTree.Node_XXX.Expanded = True/False not works anymore (this is obviously a bug and I hope it would be resolved as soon as possible since several of my scripts are using that);

4. Error because VarType(SDBSongData.FileLength) = 20 while it should be = 3 as before (one more bug);

5. some Web Browser controls are not displayed at all (Magic Nodes and RegExp scripts are affected); I am trying to find some solution, but I am afraid that this could be resolved only in the program itself.

Porting scripts for MM 4.0

Post by jiri » Thu Dec 23, 2010 10:57 am

I added a small Wiki section that describes changes that might be needed for some scripts, it's here: http://www.mediamonkey.com/wiki/index.p ... tallations

Feel free to post more examples/tips, in case you find some.

Thanks,
Jiri

Top