I'm trying to retrieve a track object from its persistent ID using AutoHotkey (v1.1) and iTunes Windows 11. The script works well until I try to use the ItemByPersistentID
method.
objITunesunesApp := ComObjCreate("iTunes.Application")
objITunesLibrary := objITunesunesApp.Sources.Item(1)
objITunesPlaylist := objITunesLibrary.Playlists.Item(1)
objITunesTrack := objITunesPlaylist.Tracks.Item(1)
; Test if objects are OK
MsgBox, % objITunesTrack.Name ; Display the song name - OK
; Get high and low IDs
intIDHigh := objITunesunesApp.ITObjectPersistentIDHigh(objITunesTrack)
intIDLow := objITunesunesApp.ITObjectPersistentIDLow(objITunesTrack)
MsgBox, %intIDHigh% %intIDLow% ; Display: "-1071797520 -947434212" OK
; Try to get the track again using the persistent IDs
objTrackByID := objITunesLibrary.ItemByPersistentID(intIDHigh, intIDLow)
; Error: 0x80020006 - Name unknown
; Specifically: ItemByPersistentID
MsgBox, % "objTrackByID.Name: " . objTrackByID.Name ; name empty
Am I calling ItemByPersistentID
the right way? Thanks.
Just found the error in the original script:
ItemByPersistentID
is a method of Tracks collections.