Hi All,
I have been using a script that has worked with 10.5 really well. Now, after the upgrade to 10.6 I am getting an error. “Can’t get document 1 of application “Quicktime Player 7”. Invalid Index.” It then launches Adobe Soundbooth. You all have been quite helpful and I thank you so much for your help.
property new_foldername : "PROXY"
set this_folder to (choose folder with prompt "Select the main shoot folder")
set foldername to name of (info for this_folder)
set folderPOSIXpath to POSIX path of this_folder
set tries to 1
set validextension to false
---coerce illegal characters to legal
--Store the current TIDs. To be polite to other scripts.
set previousDelimiter to AppleScript's text item delimiters
set potentialName to foldername as text
set legalName to {}
set illegalCharacters to {"/", ":"} --Whatever you want to eliminate.
set legalcharacter to {"-"}
--Now iterate through the characters checking them.
repeat with thisCharacter in the characters of potentialName
set thisCharacter to thisCharacter as text
if thisCharacter is not in illegalCharacters then
set the end of legalName to thisCharacter
else if thisCharacter is in illegalCharacters then
set the end of legalName to legalcharacter
end if
end repeat
--Make sure that you set the TIDs before making the
--list of characters into a string.
set AppleScript's text item delimiters to ""
--Check the name's length.
if length of legalName is greater than 32 then
set legalName to items 1 thru 32 of legalName as text
else
set legalName to legalName as text
end if
--Restore the current TIDs. To be polite to other scripts.
set AppleScript's text item delimiters to previousDelimiter
set found to paragraphs of (do shell script "/usr/bin/find " & quoted form of folderPOSIXpath & " -type d -name " & quoted form of new_foldername)
set foundCount to count found
if foundCount is 0 then
display dialog new_foldername & " folder is not found"
--if only one folder is found
else if foundCount is 1 then
set Proxypath to item 1 of found
set HFSpath to POSIX file Proxypath
tell application "Finder"
if (exists (files of folder HFSpath whose name ends with ".mp4")) then
set validextension to true
else
display dialog "There are no mp4 files in this folder." with icon stop
set tries to tries + 1
end if
end tell
if not validextension then
display dialog "This program will now close." with icon note buttons {"OK"} default button 1
else
tell application "Finder" to set sorted_items ¬
to files of folder HFSpath whose name ends with ".mp4"
repeat with i from 1 to the count of sorted_items
set this_item to (item i of sorted_items)
tell application "QuickTime Player 7"
if i is equal to 1 then
make new document
end if
open this_item
tell document 1
rewind
select all
copy
select none
end tell
close document 1 saving no
tell document 1
add
select none
end tell
end tell
end repeat
tell application "QuickTime Player 7"
if exists window 2 then
close window 2
end if
set filename to (path to desktop folder as string) & legalName & "1" & ".mov"
set newfilename to (path to desktop folder as string) & legalName & ".mov"
set dimensions of document 1 to {320, 180}
resize document 1 by 100
save self contained document 1 in newfilename
close window 1
quit
end tell
end if