Re: Problems using Applescript for duplicating a file and adding to an iTunes playlist
Re: Problems using Applescript for duplicating a file and adding to an iTunes playlist
- Subject: Re: Problems using Applescript for duplicating a file and adding to an iTunes playlist
- From: "J. Stewart" <email@hidden>
- Date: Thu, 22 Dec 2011 04:24:14 -0500
On 12/21/11 at 9:34 AM, Paul Taylor <email@hidden>
spake thusly:
I'm having problem trying to take a track from one itunes
playlist and adding it to another, this used to work now it
doesnt but I dont know if it doesnt work at all just in my test case
This is my test:
tell application "iTunes"
set mainlibrary to library playlist 1
set list_of_folders to get every folder playlist
set new_playlistfolder to item 1 of list_of_folders
set new_playlist to (make user playlist in new_playlistfolder with properties {name:"TestPlayList"})
try
set existtrack to (first file track of mainlibrary whose database ID = 14265)
duplicate existtrack to new_playlist
on error err_mess
log err_mess
end try
end tell
Paul,
For what it's worth this works just fine on my system with a
verified to exist file track. A bogus Database ID yields a -1728
error not the one you got.
System Version 10.7.2, Applescript Version 2.2.1, Script
Debugger Version 4.5.7, iTunes version 10.5.2 (11)
Result of script run -
-- started
tell application "iTunes"
get library playlist 1
--> library playlist id 40594 of source id 83
get every folder playlist
--> {folder playlist id 104834 of source id 83,
folder playlist id 93469 of source id 83,
folder playlist id 103673 of source id 83,
folder playlist id 101659 of source id 83,
folder playlist id 102173 of source id 83,
folder playlist id 104322 of source id 83,
folder playlist id 102898 of source id 83,
folder playlist id 78760 of source id 83,
folder playlist id 86510 of source id 83
}
make with properties {
name:"TestPlayList"
} at folder playlist id 104834 of source id 83 new user playlist
--> user playlist id 107689 of source id 83
get file track 1 of library playlist id 40594 of source id 83
whose database ID = 7606
--> file track id 41611 of library playlist id 40594 of source
id 83
copy file track id 41611 of library playlist id 40594 of source
id 83 to user playlist id 107689 of source id 83
--> file track id 107692 of user playlist id 107689 of source
id 83
end tell
-- stopped
Your error = error -1708: errAEEventNotHandled, the AppleEvent
was not handled by any handler.
Check your versions against mine, there may be a bug in the
creation of a new file track if your version of iTunes differs.
John
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden