' =============== ' iTunesITLPath ' =============== ' Version 1.0.0.1 - August 11th 2012 ' Copyright © Steve MacGuire 2012 ' Please visit http://samsoft.org.uk/iTunes/scripts.asp for more info. ' Determine path to active iTunes library Option Explicit Dim FSO,iTunes,nl,T Set iTunes=CreateObject("iTunes.Application") Set FSO=CreateObject("Scripting.FileSystemObject") nl=vbCrLf T=iTunesITLPath If T="" Then T="WARNING!" & nl & nl & "The iTunes Library.itl file could not be found!" Else T="The active iTunes library is:" & nl & nl & T End If MsgBox T,vbInformation,"iTunes ITL Path" ' Determine path to active iTunes library ' Modified 2012-08-11 Function iTunesITLPath Dim F,Folder,ITL,S,XML XML=iTunes.LibraryXMLPath S=InstrRev(XML,"\") Set Folder=FSO.GetFolder(Left(XML,S-1)) For Each F In Folder.Files If LCase(Right(F.Name,4))=".itl" Then If IsEmpty(ITL) Then Set ITL=F Else If F.DateLastModified>ITL.DateLastModified Then Set ITL=F End If End If Next If IsEmpty(ITL) Then iTunesITLPath="" Else iTunesITLPath=ITL.Path End If End Function