The idea is simple: if mm is running, switch to the next track. I'm having a problem with the "mm is running" part. First, GetObject doesn't seem to work at all. This line throws "ActiveX component can't create object" runtime error:
Code: Select all
Set mm = GetObject(, "SongsDB5.SDBApplication")
Therefore I can't use it to check if mm is running - I have to call CreateObject regardless of whether mm is running or not. There's another problem - if the app is not running, calling CreateObject launches the app, but then the com interface stops working. Finally, there's
SDBApplication.IsRunning flag, but it's always True for some reason.
Code: Select all
Dim mm
Set mm = CreateObject("SongsDB5.SDBApplication") ' launches the mm
Debug.Print mm.IsRunning ' prints True immediately, not even waiting for the mm to finish loading
mm.Player.Next ' doesn't switch to the next track; sometimes no visible error, sometimes it's "Access violation at address..." in the mm
And if I leave the mm open and try running the code above the second time, vb throws a runtime error "Server execution failed" on CreateObject call. Oh, and if mm was launched normally (via double-clicking on a shortcut, for example), then the script works perfectly.
So, is it me or it's an mm's issue? What the right way or maybe a workaround?