trixmoto wrote:It probably works quicker because to connect via COM it needs to run MM silently, whereas if you are running it inside MM then MM is already running. For it to be taking so much extra time I can only imagine that it is connecting to MM several times as well, instead of just once.
Maybe if you want to run the script externally you should try using a COM object to access the database directly instead of connecting to MM and using the API methods. My "BackupPlaylists" script does this, if I remember correctly.
I didn't actually know that I could run MM silently. Here is the VBScript code that I am using to get a MM COM object when running externally:
Code: Select all
Set SDB = CreateObject("SongsDB.SDBApplication")
That starts up the MM application. Is there some way to get a MM COM object without showing the application's UI?
I then get the list of songs from the Database object:
Code: Select all
Set list = SDB.Database.QuerySongs("SongLength > 0")
What do you mean by accessing the database directly? Are you connecting directly to the MS Access DB and completely bypassing the MM API?
Once I have my list iterator, I just iterate through the list, one track at a time.
[quote="trixmoto"]It probably works quicker because to connect via COM it needs to run MM silently, whereas if you are running it inside MM then MM is already running. For it to be taking so much extra time I can only imagine that it is connecting to MM several times as well, instead of just once.
Maybe if you want to run the script externally you should try using a COM object to access the database directly instead of connecting to MM and using the API methods. My "BackupPlaylists" script does this, if I remember correctly.[/quote]
I didn't actually know that I could run MM silently. Here is the VBScript code that I am using to get a MM COM object when running externally:
[code]Set SDB = CreateObject("SongsDB.SDBApplication")[/code]
That starts up the MM application. Is there some way to get a MM COM object without showing the application's UI?
I then get the list of songs from the Database object:
[code]Set list = SDB.Database.QuerySongs("SongLength > 0")[/code]
What do you mean by accessing the database directly? Are you connecting directly to the MS Access DB and completely bypassing the MM API?
Once I have my list iterator, I just iterate through the list, one track at a time.