I’ve searched and found a thread that should work for me, but it’s failing.
with timeout of 900 seconds
tell application "iTunes"
set harvey to (add ("Bell:Users:sam:Documents:myfile.mov"))
set maude to (convert harvey)
--default encoder is set to mp3
duplicate maude to user playlist "a-ruskie"
end tell
end timeout
Looking at the results, I see that the conversion step works and can confirm in iTunes. harvey has a unique file and maude does as well:
But the error is as follows:
It sounds backward to me, but I’d be OK with it worked.
I’m hoping someone can point me to what I’m not seeing, thanx, sam
Yes, thank you for replying. It certainly helps, but not quite. It puts the .mov file into the targeted user playlist, but the mp3 conversion gets dumped to the library. That’s the file I want in the user playlist. The above script fragment was my attempt to move the converted file into the user playlist. I’ve fiddled with it, but it’s not working for me, thanx, sam
tell application "Finder"
set themovie to "path:to:mov:file" as alias
set movieName to name of themovie
set mp3Name to text 1 thru -5 of movieName
end tell
tell application "iTunes"
set harvey to (add (themovie))
set maude to (convert harvey)
--default encoder is set to mp3
set newMp3 to every track of playlist 1 whose name is mp3Name and kind is "MPEG audio file"
if (count of newMp3) = 1 then
duplicate item 1 of newMp3 to user playlist "a-ruskie"
else
display dialog "There were " & (count of newMp3) & " tracks found."
end if
end tell
Make sure your import options specify MP3 Encoding.
Craig
tell application "Finder"
set themovie to "path:to:mov:file" as alias
set movieName to name of themovie
set mp3Name to text 1 thru -5 of movieName
end tell
tell application "iTunes"
set harvey to (add (themovie))
set maude to (convert harvey)
--default encoder is set to mp3
set newMp3 to every track of playlist 1 whose name is mp3Name and kind is "MPEG audio file"
try
duplicate item 1 of newMp3 to user playlist "a-ruskie"
on error errMsg
display dialog errMsg
end try
end tell
Thank you for considering my request. Running this again appears to produce the same error message as above. I’m just not seeing what could be asking for the Boolean.
And I believe I can confirm the MP3 encoding as when I look in the Advanced menu, it offers me the command to “Convert Selection to MP3”. Is there another way to ensure that it is so? thanx, sam
Thank you for continuing to look at it. This is basically your script fragment, with an Apple-supplied System Events, and get selected track as found on this forum. Because of the nature of the Shuffle, MP3 files do not seem to follow an order and this script attempts to add name info at the beginning of the sound file. Later, I’ll see how to load the Shuffle in iTunes. My iTunes version is 7.6.
As I say earlier, it errors out when trying to locate the converted MP3 file, thanx, sam
property default_voice : "Victoria"
property target_file : "Bell:Users:sam:Documents:rendered.aiff"
with timeout of 900 seconds
tell application "iTunes"
get selection of front browser window
if (selection of front browser window) is not {} then
set sel to selection
repeat with thisItem from 1 to count of sel
set x to item 1 of sel
set thetrack to location of x
set kipper to name of x
say kipper using default_voice saving to target_file
tell application "QuickTime Player"
open target_file as alias
tell document 1
select all
copy
end tell --targetfile
close document 1
open thetrack
tell document 1
paste
--export as AIFF to ("Bell:Users:sam:Documents:" & thisItem & ".aiff")
close saving in ("Bell:Users:sam:Documents:" & kipper & " Rush.mov")
end tell --doc 1
end tell --qt pro
set harvey to (add ("Bell:Users:sam:Documents:" & kipper & " Rush.mov") to user playlist "b-ruskie")
--set current encoder to "MP3 Encoder"
set maude to (convert harvey)
set newMp3 to (every track of playlist 1 whose name is (kipper & " Rush")) and kind is "MPEG audio file"
try
--if (count of newMp3) = 1 then
duplicate item 1 of newMp3 to user playlist "a-ruskie"
on error errMsg
display dialog errMsg --"There were " & (count of newMp3) & " tracks found."
--end if
end try
end repeat
end if
end tell --ituens
end timeout
You have to rename the imported file to your new name. It appears that
the original meta-data stays with the file that was exported.
The braces were incorrectly placed in “set newMp3” line
Tested it several times on Leopard and iTunes 7.6
Cheers!
Craig
set importedTrackName to kipper & " Rush"
--Change the name of the imported track to be the new name
set name of harvey to importedTrackName
set maude to (convert harvey)
set newMp3 to (every track of playlist 1 whose name is importedTrackName and kind is "MPEG audio file")