jaberwacky Posted August 14, 2010 Share Posted August 14, 2010 (edited) Here is an an object version of iTunes UDF all wrapped up in an intuitive, easy to understand little black box. I removed _Arraycreate from the UDF because I read somewhere that it's undocumented and subject to removal. Included is an iTunes Event handler object so that you can make AutoIt react to iTunes generated events such as volume changes, track changes, iTunes closing, etc. You will require the AutoItObject UDF which can be found on the forum by doing a quick search. Goodnight and goodluck... Example: expandcollapse popup#region Example =============================================================================== #include <iTunesObject.au3> #include <IE.au3> #include <Misc.au3> _Singleton(@ScriptName) HotKeySet("{ESC}", "terminate") OnAutoItExitRegister("_exit") _IEErrorHandlerRegister() _AutoItObject_Startup() Global $iTunes = iTunes() $iTunes.StartUp() Global COnst $SongName = "" ; enter the name of a song in your library Global $SelectedTracks = $iTunes.Song_GetInfo($SongName) _ArrayDisplay($SelectedTracks) Sleep(1000) $iTunes.PlayPause() Sleep(5000) $iTunes.Volume_Down() Sleep(3000) $iTunes.Volume_Mute() Sleep(3000) $iTunes.Volume_Mute() Sleep(3000) $iTunes.Volume_Set(100) Sleep(3000) $iTunes.Unload() Func _exit() $iTunes = '' _AutoItObject_Shutdown() _IEErrorHandlerDeRegister() OnAutoItExitUnregister("_exit") EndFunc ;==>_exit Func terminate() Exit EndFunc ;==>terminate #endregion Example =============================================================================== Code: expandcollapse popup#region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y #AutoIt3Wrapper_AU3Check_Parameters=-w 1 -w 2 -w 3 -w 4 -w 6 -d -q #AutoIt3Wrapper_Run_Tidy=y #Tidy_Parameters=/gd /sci1 /sci9 #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include-Once #include <AutoItObject.au3> #include <Array.au3> #include <File.au3> ; ===================================================================================== #region iTunesEvents Func iTunesEvents() Local $This = _AutoItObject_Create() _AutoItObject_AddProperty($This, "Events", $ELSCOPE_PRIVATE) _AutoItObject_AddMethod($This, "Register", "iTunesEventsRegister") _AutoItObject_AddMethod($This, "OnPlayerPlayEvent", "iTunesEvents_OnPlayerPlayEvent", True) _AutoItObject_AddMethod($This, "OnPlayerStopEvent", "iTunesEvents_OnPlayerStopEvent", True) _AutoItObject_AddMethod($This, "OnPlayerPlayingTrackChangedEvent", "iTunesEvents_OnPlayerPlayingTrackChangedEvent", True) _AutoItObject_AddMethod($This, "OnCOMCallsDisabledEvent", "iTunesEvents_OnCOMCallsDisabledEvent", True) _AutoItObject_AddMethod($This, "OnCOMCallsEnabledEvent", "iTunesEvents_OnCOMCallsEnabledEvent", True) _AutoItObject_AddMethod($This, "OnQuittingEvent", "iTunesEvents_OnQuittingEvent", True) _AutoItObject_AddMethod($This, "OnAboutToPromptUserToQuitEvent", "iTunesEvents_OnAboutToPromptUserToQuitEvent", True) _AutoItObject_AddMethod($This, "OnSoundVolumeChangedEvent", "iTunesEvents_OnSoundVolumeChangedEvent", True) Return $This EndFunc ;==>iTunesEvents ;The ITEventPlayerPlay event is fired when a track begins playing. Func iTunesEvents_OnPlayerPlayEvent() ; handle the event EndFunc ;==>iTunesEvents_OnPlayerPlayEvent ; ===================================================================================== ;The ITEventPlayerStop event is fired when a track stops playing. Func iTunesEvents_OnPlayerStopEvent() ; handle the event EndFunc ;==>iTunesEvents_OnPlayerStopEvent ; ===================================================================================== ;The ITEventPlayerPlayingTrackChanged event is fired when information about the currently playing track has changed. Func iTunesEvents_OnPlayerPlayingTrackChangedEvent() ; handle the event EndFunc ;==>iTunesEvents_OnPlayerPlayingTrackChangedEvent ; ===================================================================================== ;The ITEventCOMCallsDisabled event is fired when calls to the iTunes COM interface will be deferred. Func iTunesEvents_OnCOMCallsDisabledEvent() ; handle the event EndFunc ;==>iTunesEvents_OnCOMCallsDisabledEvent ; ===================================================================================== ;The ITEventCOMCallsEnabled event is fired when calls to the iTunes COM interface will no longer be deferred. Func iTunesEvents_OnCOMCallsEnabledEvent() ; handle the event EndFunc ;==>iTunesEvents_OnCOMCallsEnabledEvent ; ===================================================================================== ;The ITEventQuitting event is fired when iTunes is about to quit. Func iTunesEvents_OnQuittingEvent() ; handle the event EndFunc ;==>iTunesEvents_OnQuittingEvent ; ===================================================================================== ;The ITEventAboutToPromptUserToQuit event is fired when iTunes is about prompt the user to quit. Func iTunesEvents_OnAboutToPromptUserToQuitEvent() ; handle the event EndFunc ;==>iTunesEvents_OnAboutToPromptUserToQuitEvent ; ===================================================================================== ;The ITEventSoundVolumeChanged event is fired when the sound output volume has changed. Func iTunesEvents_OnSoundVolumeChangedEvent($NewVolume) ; Handle the event EndFunc ;==>iTunesEvents_OnSoundVolumeChangedEvent ; ===================================================================================== Func iTunesEventsRegister($This, Const $iTunesApp) $This.Events = ObjEvent($iTunesApp, "iTunesEvents_") Return $This.Events EndFunc ;==>iTunesEventsRegister #endregion iTunesEvents ; ===================================================================================== ; ===================================================================================== #region iTunes Func iTunes() Local Const $file = _TempFile(Default, Default, ".jpg") Local $This = _AutoItObject_Create() _AutoItObject_AddProperty($This, "iTunesApp", $ELSCOPE_PRIVATE) _AutoItObject_AddProperty($This, "iTunesEvents", $ELSCOPE_PRIVATE, iTunesEvents()) _AutoItObject_AddProperty($This, "Library_Playlist", $ELSCOPE_PRIVATE, '') _AutoItObject_AddProperty($This, "Library_Tracks", $ELSCOPE_PRIVATE, '') _AutoItObject_AddProperty($This, "Playlist_Handle", $ELSCOPE_PRIVATE, '') _AutoItObject_AddProperty($This, "Player_State", $ELSCOPE_PRIVATE, '') _AutoItObject_AddProperty($This, "Current_Track", $ELSCOPE_PRIVATE, '') _AutoItObject_AddProperty($This, "Selected_Tracks", $ELSCOPE_PRIVATE, '') _AutoItObject_AddProperty($This, "VolPercent", $ELSCOPE_PRIVATE, 10) _AutoItObject_AddProperty($This, "File", $ELSCOPE_PRIVATE, $file) _AutoItObject_AddProperty($This, "Mute", $ELSCOPE_PRIVATE, False) _AutoItObject_AddMethod($This, "GotoMusicStoreHomepage", "iTunes_GotoMusicStoreHomepage") _AutoItObject_AddMethod($This, "Current_LyricsSet", "iTunes_Current_LyricsSet") _AutoItObject_AddMethod($This, "Current_LyricsGet", "iTunes_Current_LyricsGet") _AutoItObject_AddMethod($This, "Current_ArtworkSaveToTmp", "iTunes_Current_ArtworkSaveToTmp") _AutoItObject_AddMethod($This, "Current_ArtworkGet", "iTunes_Current_ArtworkGet") _AutoItObject_AddMethod($This, "Current_ArtworkSet", "iTunes_Current_ArtworkSet") _AutoItObject_AddMethod($This, "Current_GetInfo", "iTunes_Current_GetInfo") _AutoItObject_AddMethod($This, "Get_ITL_Path", "iTunes_Get_ITL_Path") _AutoItObject_AddMethod($This, "Get_Selected", "iTunes_Get_Selected") _AutoItObject_AddMethod($This, "iPod_Eject", "iTunes_iPod_Eject") _AutoItObject_AddMethod($This, "iPod_Update", "iTunes_iPod_Update") _AutoItObject_AddMethod($This, "iPod_Version", "iTunes_iPod_Version") _AutoItObject_AddMethod($This, "LibraryTracks", "iTunes_Library_Tracks") _AutoItObject_AddMethod($This, "Library_CountTracks", "iTunes_Library_CountTracks") _AutoItObject_AddMethod($This, "Library_AddTrack", "iTunes_Library_AddTrack") _AutoItObject_AddMethod($This, "Library_DeleteTrack", "iTunes_Library_DeleteTrack") _AutoItObject_AddMethod($This, "MiniPlayer", "iTunes_MiniPlayer") _AutoItObject_AddMethod($This, "OpenUrl", "iTunes_OpenUrl") _AutoItObject_AddMethod($This, "Player_Get_State", "iTunes_Player_Get_State") _AutoItObject_AddMethod($This, "PlayFile", "iTunes_PlayFile") _AutoItObject_AddMethod($This, "PlayList_Create", "iTunes_PlayList_Create") _AutoItObject_AddMethod($This, "PlayList_Add", "iTunes_PlayList_Add") _AutoItObject_AddMethod($This, "Playlist_Delete", "iTunes_Playlist_Delete") _AutoItObject_AddMethod($This, "Playlist_Info", "iTunes_Playlist_Info") _AutoItObject_AddMethod($This, "Playlist_PlayFirst", "iTunes_Playlist_PlayFirst") _AutoItObject_AddMethod($This, "Podcast_Subscribe", "iTunes_Podcast_Subscribe") _AutoItObject_AddMethod($This, "Podcast_UpdateFeeds", "iTunes_Podcast_UpdateFeeds") _AutoItObject_AddMethod($This, "Selected_GetInfo", "iTunes_Selected_GetInfo") _AutoItObject_AddMethod($This, "Song_ArtworkSaveToTmp", "iTunes_Song_ArtworkSaveToTmp") _AutoItObject_AddMethod($This, "Song_Artwork_Get", "iTunes_Song_Artwork_Get") _AutoItObject_AddMethod($This, "Song_Artwork_Set", "iTunes_Song_Artwork_Set") _AutoItObject_AddMethod($This, "Song_GetInfo", "iTunes_Song_GetInfo") _AutoItObject_AddMethod($This, "Song_LyricsGet", "iTunes_Song_LyricsGet") _AutoItObject_AddMethod($This, "Song_LyricsSet", "iTunes_Song_LyricsSet") _AutoItObject_AddMethod($This, "StartUp", "iTunes_StartUp") _AutoItObject_AddMethod($This, "GotoMusicStoreHomepage", "iTunes_Store_GotoMusicStoreHomepage") _AutoItObject_AddMethod($This, "BackTrack", "iTunes_Track_BackTrack") _AutoItObject_AddMethod($This, "Next", "iTunes_Track_Next") _AutoItObject_AddMethod($This, "PlayPause", "iTunes_Track_PlayPause") _AutoItObject_AddMethod($This, "Prev", "iTunes_Track_Prev") _AutoItObject_AddMethod($This, "Unload", "iTunes_Unload") _AutoItObject_AddMethod($This, "Visuals_Enable", "iTunes_Visuals_Enable") _AutoItObject_AddMethod($This, "Visuals_Disable", "iTunes_Visuals_Disable") _AutoItObject_AddMethod($This, "Volume_Down", "iTunes_Volume_Down") _AutoItObject_AddMethod($This, "Volume_Get", "iTunes_Volume_Get") _AutoItObject_AddMethod($This, "Volume_Mute", "iTunes_Volume_Mute") _AutoItObject_AddMethod($This, "Volume_Set", "iTunes_Volume_Set") _AutoItObject_AddMethod($This, "Volume_Up", "iTunes_Volume_Up") _AutoItObject_AddMethod($This, "Quit", "iTunes_Quit", True) Return $This EndFunc ;==>iTunes Func iTunes_Current_LyricsSet($This, Const $Lyric_Text) $This.iTunesApp.CurrentTrack.Lyrics = $Lyric_Text EndFunc ;==>iTunes_Current_LyricsSet ; ===================================================================================== Func iTunes_Current_LyricsGet($This) Return $This.iTunesApp.CurrentTrack.Lyrics EndFunc ;==>iTunes_Current_LyricsGet ; ===================================================================================== Func iTunes_Current_ArtworkSaveToTmp($This) $This.iTunesApp.CurrentTrack.Artwork(1).SaveArtworkToFile($This.File) EndFunc ;==>iTunes_Current_ArtworkSaveToTmp ; ===================================================================================== Func iTunes_Current_ArtworkGet($This) $This.iTunesApp.CurrentTrack.Artwork(1).SaveArtworkToFile($This.File) EndFunc ;==>iTunes_Current_ArtworkGet ; ===================================================================================== Func iTunes_Current_ArtworkSet($This, Const $Path) $This.iTunesApp.CurrentTrack.Artwork(1).SetArtworkFromFile($Path) EndFunc ;==>iTunes_Current_ArtworkSet ; ===================================================================================== Func iTunes_Current_GetInfo($This) Local $tInfo[1] _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.Album) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.Artist) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.BitRate) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.Comment) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.Compilation) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.Composer) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.DateAdded) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.Duration) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.EQ) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.Genre) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.KindAsString) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.ModificationDate) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.Name) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.PlayedCount) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.PlayedDate) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.Playlist) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.Rating) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.SampleRate) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.Size) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.Time) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.TrackNumber) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.VolumeAdjustment) _ArrayAdd($tInfo, $This.iTunesApp.CurrentTrack.Year) _ArrayDelete($tInfo, 0) Return $tInfo EndFunc ;==>iTunes_Current_GetInfo ; ===================================================================================== Func iTunes_Get_ITL_Path($This) Return $This.iTunesApp.LibraryXMLPath EndFunc ;==>iTunes_Get_ITL_Path ; ===================================================================================== Func iTunes_Get_Selected($This, Const $Flag) Local $aSelTracks[1] Switch $Flag Case 1 For $Track In $This.iTunesApp.SelectedTracks _ArrayAdd($aSelTracks, $Track.name) $aSelTracks[0] = UBound($aSelTracks) - 1 Next Case 2 For $Track In $This.iTunesApp.SelectedTracks _ArrayAdd($aSelTracks, $Track.Location) $aSelTracks[0] = UBound($aSelTracks) - 1 Next Case 3 For $Track In $This.iTunesApp.SelectedTracks _ArrayAdd($aSelTracks, $Track.Rating) $aSelTracks[0] = UBound($aSelTracks) - 1 Next Case 4 For $Track In $This.iTunesApp.SelectedTracks _ArrayAdd($aSelTracks, $Track.Time) $aSelTracks[0] = UBound($aSelTracks) - 1 Next EndSwitch Return $aSelTracks EndFunc ;==>iTunes_Get_Selected ; ===================================================================================== Func iTunes_iPod_Eject($This) $This.iTunesApp.iPodSource.EjectIPod EndFunc ;==>iTunes_iPod_Eject ; ===================================================================================== Func iTunes_iPod_Update($This) $This.iTunesApp.iPodSource.UpdateIPod EndFunc ;==>iTunes_iPod_Update ; ===================================================================================== Func iTunes_iPod_Version($This) Return $This.iTunesApp.iPodSource.SoftwareVersion EndFunc ;==>iTunes_iPod_Version ; ===================================================================================== Func iTunes_Library_Tracks($This) Local $aArray[1] Local Const $LibraryTracks = $This.Library_Tracks If IsArray($LibraryTracks) Then For $i = 0 To UBound($LibraryTracks) - 1 ConsoleWrite($LibraryTracks[$i] & @LF) Next For $Item In $LibraryTracks _ArrayAdd($aArray, $Item.Name) Next $aArray[0] = $This.iTunes_Library_CountTracks() Return $aArray EndIf EndFunc ;==>iTunes_Library_Tracks ; ===================================================================================== Func iTunes_Library_CountTracks($This) Return $This.Library_Tracks.Count EndFunc ;==>iTunes_Library_CountTracks ; ===================================================================================== Func iTunes_Library_AddTrack($This, Const $Path) $This.Library_Playlist.AddTrack($Path) EndFunc ;==>iTunes_Library_AddTrack ; ===================================================================================== Func iTunes_Library_DeleteTrack($This, Const $Song_Name) $This.Library_Tracks.ItemByName($Song_Name).Delete EndFunc ;==>iTunes_Library_DeleteTrack ; ===================================================================================== Func iTunes_MiniPlayer($This, Const $State = 1) If $State = 1 Then $This.iTunesApp.Browserwindow.MiniPlayer = 1 Else $This.iTunesApp.Browserwindow.MiniPlayer = 0 EndIf Return $This.iTunesApp.Browserwindow.MiniPlayer EndFunc ;==>iTunes_MiniPlayer ; ===================================================================================== Func iTunes_OpenUrl($This, Const $OpenUrl) $This.iTunesApp.OpenURL($OpenUrl) EndFunc ;==>iTunes_OpenUrl ; ===================================================================================== Func iTunes_Player_Get_State($This) Return $This.iTunesApp.PlayerState EndFunc ;==>iTunes_Player_Get_State ; ===================================================================================== Func iTunes_PlayFile($This, Const $PlayFile) $This.iTunesApp.PlayFile($PlayFile) EndFunc ;==>iTunes_PlayFile ; ===================================================================================== Func iTunes_PlayList_Create($This, Const $P_Name) $This.iTunesApp.CreatePlaylist($P_Name) EndFunc ;==>iTunes_PlayList_Create ; ===================================================================================== Func iTunes_PlayList_Add($This, Const $PlayList_Name, Const $Song_Name) Local Const $sng_nm = $This.Library_Tracks.ItemByName($Song_Name) $This.Playlist_Handle.ItemByName($PlayList_Name).AddTrack($sng_nm) EndFunc ;==>iTunes_PlayList_Add ; ===================================================================================== Func iTunes_Playlist_Delete($This, Const $PlayList_Name) $This.Playlist_Handle.ItemByName($PlayList_Name).Delete EndFunc ;==>iTunes_Playlist_Delete ; ===================================================================================== Func iTunes_Playlist_Info($This, Const $PlayList_Name) Local Const $PlayList = $This.Playlist_Handle.ItemByName($PlayList_Name) Local $pInfo[1] _ArrayAdd($pInfo, $PlayList.Kind) _ArrayAdd($pInfo, $PlayList.duration) _ArrayAdd($pInfo, $PlayList.shuffle) _ArrayAdd($pInfo, $PlayList.size) _ArrayAdd($pInfo, $PlayList.SongRepeat) _ArrayAdd($pInfo, $PlayList.time) _ArrayAdd($pInfo, $PlayList.Visible) _ArrayDelete($pInfo, 0) Return $pInfo EndFunc ;==>iTunes_Playlist_Info ; ===================================================================================== Func iTunes_Playlist_PlayFirst($This, Const $PlayList_Name) $This.Playlist_Handle.ItemByName($PlayList_Name).PlayFirstTrack EndFunc ;==>iTunes_Playlist_PlayFirst ; ===================================================================================== Func iTunes_Playlist_Search($This, Const $PlayList_Name, Const $Search) Local $Return Local Const $sResults = $This.Playlist_Handle.ItemByName($PlayList_Name).search($Search, 0) For $Track In $sResults _ArrayAdd($Return, $Track) Next Return $Return EndFunc ;==>iTunes_Playlist_Search ; ===================================================================================== Func iTunes_Podcast_Subscribe($This, Const $Podcast_Url) $This.iTunesApp.SubscribeToPodcast($Podcast_Url) EndFunc ;==>iTunes_Podcast_Subscribe ; ===================================================================================== Func iTunes_Podcast_UpdateFeeds($This) $This.iTunesApp.UpdatePodcastFeeds EndFunc ;==>iTunes_Podcast_UpdateFeeds ; ===================================================================================== Func iTunes_Quit($This) $This.iTunesApp.Quit EndFunc ;==>iTunes_Quit ; ===================================================================================== Func iTunes_Selected_GetInfo($This) Local $sInfo, $tInfo For $Track In $This.iTunesApp.SelectedTracks $tInfo = $Track.Album & '|' & _ $Track.artist & '|' & _ $Track.BPM & '|' & _ $Track.comment & '|' & _ $Track.Compilation & '|' & _ $Track.Composer & '|' & _ $Track.DateAdded & '|' & _ $Track.Duration & '|' & _ $Track.EQ & '|' & _ $Track.Genre & '|' & _ $Track.KindAsString & '|' & _ $Track.ModificationDate & '|' & _ $Track.PlayedCount & '|' & _ $Track.PlayedDate & '|' & _ $Track.Playlist & '|' & _ $Track.Rating & '|' & _ $Track.SampleRate & '|' & _ $Track.Size & '|' & _ $Track.Time & '|' & _ $Track.TrackNumber & '|' & _ $Track.VolumeAdjustment & '|' & _ $Track.Year _ArrayAdd($sInfo, $tInfo) Next Return $sInfo EndFunc ;==>iTunes_Selected_GetInfo ; ===================================================================================== Func iTunes_Song_ArtworkSaveToTmp($This, Const $Song_Name) $This.Library_Tracks.ItemByName($Song_Name).Artwork(1).SaveArtworkToFile($This.File) EndFunc ;==>iTunes_Song_ArtworkSaveToTmp ; ===================================================================================== Func iTunes_Song_Artwork_Get($This, Const $Song_Name) $This.Library_Tracks.ItemByName($Song_Name).Artwork(1).SaveArtworkToFile($This.File) EndFunc ;==>iTunes_Song_Artwork_Get ; ===================================================================================== Func iTunes_Song_Artwork_Set($This, Const $Song_Name, Const $Path) $This.Library_Tracks.ItemByName($Song_Name).Artwork(1).SetArtworkFromFile($Path) EndFunc ;==>iTunes_Song_Artwork_Set ; ===================================================================================== Func iTunes_Song_GetInfo($This, Const $Song_Name) If Not IsString($Song_Name) Then Return SetError(-1, 0, 1) Local Const $Song = $This.Library_Tracks.ItemByName($Song_Name) If IsObj($Song) Then Local $tInfo[1] _ArrayAdd($tInfo, $Song.Album) _ArrayAdd($tInfo, $Song.artist) _ArrayAdd($tInfo, $Song.BPM) _ArrayAdd($tInfo, $Song.comment) _ArrayAdd($tInfo, $Song.Compilation) _ArrayAdd($tInfo, $Song.Composer) _ArrayAdd($tInfo, $Song.DateAdded) _ArrayAdd($tInfo, $Song.Duration) _ArrayAdd($tInfo, $Song.EQ) _ArrayAdd($tInfo, $Song.Genre) _ArrayAdd($tInfo, $Song.KindAsString) _ArrayAdd($tInfo, $Song.ModificationDate) _ArrayAdd($tInfo, $Song.PlayedCount) _ArrayAdd($tInfo, $Song.PlayedDate) _ArrayAdd($tInfo, $Song.Playlist) _ArrayAdd($tInfo, $Song.Rating) _ArrayAdd($tInfo, $Song.SampleRate) _ArrayAdd($tInfo, $Song.Size) _ArrayAdd($tInfo, $Song.Time) _ArrayAdd($tInfo, $Song.TrackNumber) _ArrayAdd($tInfo, $Song.VolumeAdjustment) _ArrayAdd($tInfo, $Song.Year) _ArrayDelete($tInfo, 0) Return $tInfo Else Return SetError(-2, 0, 1) EndIf EndFunc ;==>iTunes_Song_GetInfo ; ===================================================================================== Func iTunes_Song_LyricsGet($This, Const $Song_Name) Return $This.Library_Tracks.ItemByName($Song_Name).Lyrics EndFunc ;==>iTunes_Song_LyricsGet ; ===================================================================================== Func iTunes_Song_LyricsSet($This, Const $Song_Name, Const $Lyrics) $This.Library_Tracks.ItemByName($Song_Name).Lyrics = $Lyrics EndFunc ;==>iTunes_Song_LyricsSet ; ===================================================================================== Func iTunes_StartUp($This) $This.iTunesApp = ObjCreate("iTunes.Application") $This.iTunesEvents.Register($This.iTunesApp) $This.Library_Playlist = $This.iTunesApp.LibraryPlaylist $This.Library_Tracks = $This.iTunesApp.LibraryPlaylist.Tracks $This.Selected_Tracks = $This.iTunesApp.SelectedTracks $This.Current_Track = $This.iTunesApp.CurrentTrack $This.Player_State = $This.iTunesApp.PlayerState $This.Playlist_Handle = $This.iTunesApp.LibrarySource.Playlists Return $This.iTunesApp EndFunc ;==>iTunes_StartUp ; ===================================================================================== Func iTunes_Store_GotoMusicStoreHomepage($This) $This.iTunesApp.GotoMusicStoreHomepage() EndFunc ;==>iTunes_Store_GotoMusicStoreHomepage ; ===================================================================================== Func iTunes_Track_BackTrack($This) $This.iTunesApp.BackTrack() EndFunc ;==>iTunes_Track_BackTrack ; ===================================================================================== Func iTunes_Track_Next($This) $This.iTunesApp.NextTrack EndFunc ;==>iTunes_Track_Next ; ===================================================================================== Func iTunes_Track_PlayPause($This) $This.iTunesApp.PlayPause EndFunc ;==>iTunes_Track_PlayPause ; ===================================================================================== Func iTunes_Track_Prev($This) $This.iTunesApp.PreviousTrack EndFunc ;==>iTunes_Track_Prev ; ===================================================================================== Func iTunes_Unload($This) If IsObj($This.iTunesApp) Then $This.iTunesApp.Quit() $This.iTunesApp = '' EndIf EndFunc ;==>iTunes_Unload ; ===================================================================================== Func iTunes_Visuals_Enable($This) $This.iTunesApp.VisualsEnabled = 1 EndFunc ;==>iTunes_Visuals_Enable ; ===================================================================================== Func iTunes_Visuals_Disable($This) $This.iTunesApp.VisualsEnabled = 0 EndFunc ;==>iTunes_Visuals_Disable ; ===================================================================================== Func iTunes_Volume_Down($This) $This.iTunesApp.SoundVolume = $This.iTunesApp.SoundVolume - $This.VolPercent EndFunc ;==>iTunes_Volume_Down ; ===================================================================================== Func iTunes_Volume_Get($This) Return $This.iTunesApp.SoundVolume EndFunc ;==>iTunes_Volume_Get ; ===================================================================================== Func iTunes_Volume_Mute($This) $This.Mute = String(Not $This.iTunesApp.Mute) $This.iTunesApp.Mute = $This.Mute EndFunc ;==>iTunes_Volume_Mute ; ===================================================================================== Func iTunes_Volume_Set($This, Const $NewVolume) $This.iTunesApp.SoundVolume = $NewVolume EndFunc ;==>iTunes_Volume_Set ; ===================================================================================== Func iTunes_Volume_Up($This) $This.iTunesApp.SoundVolume = $This.iTunesApp.SoundVolume + $This.VolPercent EndFunc ;==>iTunes_Volume_Up #endregion iTunes ; ===================================================================================== Edited August 14, 2010 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now