on run {input, parameters}
tell application "QuickTime Player 7"
activate
close every window
repeat with i in input
open (i as alias)
set {name:Nm, name extension:Ex} to info for (i as alias)
set rutafichero to POSIX path of (i as alias)
set rutacarpeta to text 1 thru ((count rutafichero) - (count Nm)) of rutafichero
if Ex is missing value then set Ex to ""
if Ex is not "" then set Nm to text 1 thru ((count Nm) - (count Ex) - 1) of Nm
set newFile to rutacarpeta & Nm & " - Preview.avi"
export front document to newFile as AVI using settings "RECURSOS:SCRIPTS:CONVERTIR A AVI:AVI DV PAL.set" with replacing
set end of output_items to newFile as alias
close front document
end repeat
end tell
return input
end run
In input are some mov files, the question is, Why only convert the first item of input? after first conversion the script stop with an error
on run {input, parameters}
set output_items to {}
tell application "QuickTime Player 7"
activate
close every window
repeat with i in input
open (i as alias)
set {name:Nm, name extension:Ex} to info for (i as alias)
set rutafichero to POSIX path of (i as alias)
set rutacarpeta to text 1 thru ((count rutafichero) - (count Nm)) of rutafichero
if Ex is missing value then set Ex to ""
if Ex is not "" then set Nm to text 1 thru ((count Nm) - (count Ex) - 1) of Nm
set newFile to rutacarpeta & Nm & " - Preview.avi"
export front document to newFile as AVI using settings "RECURSOS:SCRIPTS:CONVERTIR A AVI:AVI DV PAL.set" with replacing
set end of output_items to newFile as alias
close front document
end repeat
end tell
return output_items
end run
I dont know how solve this “newFile is a POSIX path which cannot be coerced to alias”
on run {input, parameters}
set output_items to {}
tell application "QuickTime Player 7"
activate
close every window
repeat with i in input
open i
set {name:Nm, name extension:Ex} to info for i
set rutafichero to i as text
set rutacarpeta to text 1 thru ((count rutafichero) - (count Nm)) of rutafichero
if Ex is missing value then set Ex to ""
if Ex is not "" then set Nm to text 1 thru ((count Nm) - (count Ex) - 1) of Nm
set newFile to rutacarpeta & Nm & " - Preview.avi"
with timeout of 3600 seconds
export front document to newFile as AVI using settings "RECURSOS:SCRIPTS:CONVERTIR A AVI:AVI DV PAL.set" with replacing
end timeout
set end of output_items to newFile as alias
close front document
end repeat
end tell
return output_items
end run
I removed also the as alias coercions, because the items in input are alias specifiers
and added a timeout block to avoid a timeout after 2 minutes