Я пытаюсь создать сценарий, который берет дорожки из iTunes, находит их местоположение в поисковике, и, если в папке есть потенциальная обложка, она применяет обложку к выбору iTunes.
У меня все детали работаюткроме добавления обложки в трек iTunes.
В последней строке я получаю ошибку itunes -206.Я перепробовал много вариантов и не могу заставить это работать.Любая помощь будет оценена:
tell application "iTunes"
set _data to selection
set artworknum to count of artwork of item 1 of _data
set trk1 to location of item 1 of _data
set scanfolderfound to false
set artworkfound to false
if artworknum = 0 then
tell application "Finder"
set trkfolder to container of trk1
set allfolderitems to every item of trkfolder
-- return allfolderitems
repeat with x in allfolderitems -- see if the scan folder is present
if kind of x is "Folder" and name of x contains "Scans" then -- if scans folder found then get its contents
set scanfolder to every item of x
set scanfolderfound to true
repeat with y in scanfolder
if name of y contains "Art" and {"jpg", "png"} contains name extension of y then
set artworkfound to true
set artworkfile to y as alias
exit repeat
end if
end repeat
exit repeat
end if
end repeat
end tell
-- return artworkfound
set filepath to POSIX path of artworkfile
if artworkfound then
tell application "Image Events"
set artworkfile to open artworkfile
-- return artworkfile
save artworkfile as PICT in (POSIX file filepath)
close artworkfile
end tell
end if
set artworkfile1 to (read (filepath as POSIX file) from 513 as picture)
repeat with trk in _data
-- return trk
set data of artwork 1 of trk to artworkfile1
end repeat
end if
end tell