This was trickier than I expected.
For (non-portable) MediaMonkey 3, the MM.DB database path was:
C:/Users/<user>/AppData/Local/MediaMonkey
However, it contained no Scripts folder inside that. Instead the scripts path is located:
<MM3 standard installation path>/Scripts
Obviously, Anthony's code will predict:
C:/Users/<user>/AppData/Local/MediaMonkey/Scripts
The portable version of MediaMonkey 4 was different too. Here the database path was:
<MM4 portable installation path>/Portable/
The actual scripts path is:
<MM4 portable installation path>/Scripts
And Anthony's code will instead predict this:
<MM4 portable installation path>/Portable/Scripts
Unfortunately, the only one which works is the standard non-portable MM4 installation:
Database path:
C:/Users/<user>/AppData/Roaming/MediaMonkey
The actual scripts path is:
C:/Users/<user>/AppData/Roaming/MediaMonkey/Scripts
And Anthony's code will predict this:
C:/Users/<user>/AppData/Roaming/MediaMonkey/Scripts
...which is of course the same as the actual script path, which is why MM4 non-portable works fine.
Okay this is tricky...
One plan is to simply save where the database is, and then create my own folder along with MM.DB in there. However, this could change in future, and if people upgrade from MM3 or portable, then my program's data will be lost again for the new version.
I'm beginning to think I should step out of Mediamonkey's location of where it's 'supposed to go', and instead just rely on my own independent location (I think your former longer code with %appdata% is a good direction here). Apart from avoiding the need to specialize for each case of Mediamonkey (3, 4, 4-portable), it also means I'll be safe if Mediamonkey decides to change paths again
This was trickier than I expected.
For (non-portable) MediaMonkey 3, the MM.DB database path was:
C:/Users/<user>/AppData/Local/MediaMonkey
However, it contained no Scripts folder inside that. Instead the scripts path is located:
<MM3 standard installation path>/Scripts
Obviously, Anthony's code will predict:
C:/Users/<user>/AppData/Local/MediaMonkey/Scripts
The portable version of MediaMonkey 4 was different too. Here the database path was:
<MM4 portable installation path>/Portable/
The actual scripts path is:
<MM4 portable installation path>/Scripts
And Anthony's code will instead predict this:
<MM4 portable installation path>/Portable/Scripts
Unfortunately, the only one which works is the standard non-portable MM4 installation:
Database path:
C:/Users/<user>/AppData/Roaming/MediaMonkey
The actual scripts path is:
C:/Users/<user>/AppData/Roaming/MediaMonkey/Scripts
And Anthony's code will predict this:
C:/Users/<user>/AppData/Roaming/MediaMonkey/Scripts
...which is of course the same as the actual script path, which is why MM4 non-portable works fine.
Okay this is tricky...
One plan is to simply save where the database is, and then create my own folder along with MM.DB in there. However, this could change in future, and if people upgrade from MM3 or portable, then my program's data will be lost again for the new version.
I'm beginning to think I should step out of Mediamonkey's location of where it's 'supposed to go', and instead just rely on my own independent location (I think your former longer code with %appdata% is a good direction here). Apart from avoiding the need to specialize for each case of Mediamonkey (3, 4, 4-portable), it also means I'll be safe if Mediamonkey decides to change paths again ;)