Sign in to follow this  
Followers 0
Damein

Need help with iTunes COM

2 posts in this topic

So I am trying to implement some iTunes control in a script but I am having trouble finding out how to use their COM files (Never used anything with COM before)

So here is the section from the iTunes COM Interface file:

HRESULT _IiTunesEvents::OnPlayerPlayEvent  (  [in] VARIANT  iTrack   )   
 
   The ITEventPlayerPlay event is fired when a track begins playing. 

When iTunes switches to playing another track, you will received an ITEventPlayerStop event followed by an ITEventPlayerPlay event, unless it is playing joined CD tracks (see _IiTunesEvents::OnPlayerPlayingTrackChangedEvent).


Parameters:
 iTrack  An IITTrack object (a VARIANT of type VT_DISPATCH) corresponding to the track that has started playing.

So I am attempting to make a script do something if a song starts to play. I was able to use other parts of the help file like:

HRESULT IiTunes::PlayPause  (    )   
 
   Toggle the playing/paused state of the current track. 


Return values:
 S_OK  The operation was successful.  
 E_FAIL  An unexpected error occurred.

But I can't seem to use the song start one.

Any help would be much appreciated, thanks.


MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Share this post


Link to post
Share on other sites



Again...I don't have iTunes installed so this is only guessing, might want to try it out in a test script or something:

#include <iTunes.au3>
;object is $iTunesApp
Global $aCurrentTrack

;Create event handler for $iTunesApp object
$iTunesObjEvent = ObjEvent($iTunesApp, "iTunesEvent_")

Func iTunesEvent_OnPlayerPlayEvent($objTrack)
    _ITunesUpdateCurrentTrack()     ;Update info array
    ConsoleWrite("Now playing: " & $aCurrentTrack[2] & @CRLF)       ;Is $aCurrentTrack[2] the title?
EndFunc

;Following updates the current track info array
Func _ITunesUpdateCurrentTrack()
    $aCurrentTrack = _iTunes_Current_GetInfo()
EndFunc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0