Although it probably won't affect many scripts and their authors, I rather announce a small change introduced in MM 3.1.0.1205: Each script will only have one instance in memory, unlike in previous versions, where it was possible to have several instanced loaded under some conditions. I added some info about it to wiki at http://www.mediamonkey.com/wiki/index.p ... pt_loading , its copy follows below.
Let me know in case of any troubles.
Jiri
Internal mechanism of script loading
Normally, you don't need to know much about internal handling of scripts by MediaMonkey, but sometimes it might be useful to know, when exactly scripts are loaded.
When some function of a script is about to be executed (e.g. OnStartup function of auto-scripts), the script is loaded to memory and executed as necessary. When the execution finishes, the script is again unloaded from memory. However, there is on exception - if you register some event (by calling RegisterEvent function), the script remains still loaded in memory, until all registered events are unregistered, then it's unloaded.
This is good to know when you plan some sharing of variables. While the script is loaded in memory, you can use its global variables, but if you need to persist some values or objects between script sessions, you have to use some other mechanism (ini files, Objects collection, ...).
Note that starting from MediaMonkey 3.1.0.1205, there is always at most one instance of script loaded in memory. In older versions, if a script registered some events and then e.g. Option sheet functions were called back by MediaMonkey, they were processed in another instance of the script. Now they are processed in the already loaded instance, which helps avoid some memory leaks, is easier to handle and is also faster to process.



