Saturday, January 19, 2019

#1 2005-11-30 02:12:52 pm

Duncan
Member
Registered: 2005-11-30
Posts: 3

QuickTime Export Droplet

Hello - I'm new to the forums and would like to find an Applescript programmer to create a "droplet" for us.

The job:
We need a droplet that we can drag a folder of Quicktime movies on to, have the droplet open each movie, then do an Export to a specific format.

We would like the export to go a specific directory path in User > Documents.

Finally, the script deletes the original folder of clips.

If you are interested and would like further details, please email with your contact information and the rate and estimated time that you'll need to complete the job.

Cheers!

Duncan big_smile

Offline

 

#2 2005-11-30 03:47:02 pm

Bruce Phillips
Administrator
Registered: 2004-07-16
Posts: 2649

Re: QuickTime Export Droplet

Would you mind specifying what format you want to export to?

You can also tell QuickTime Player to use a file containing the export settings, if you'd rather do that.

Offline

 

#3 2005-11-30 03:50:34 pm

Duncan
Member
Registered: 2005-11-30
Posts: 3

Re: QuickTime Export Droplet

Sure - sorry about that.

The originals will be H.264 to be exported to the DV codec.

Last edited by Duncan (2005-11-30 03:51:08 pm)

Offline

 

#4 2005-12-01 08:36:57 am

Bruce Phillips
Administrator
Registered: 2004-07-16
Posts: 2649

Re: QuickTime Export Droplet

Try this:

Applescript:

property exportFolder : (path to documents folder as Unicode text) & "Your Folder:"

on run
   choose folder with prompt "Change video files from these folders:" with multiple selections allowed
   open (result)
end run

on open droppedItems
   tell application "QuickTime Player"
       activate
       close every window
   end tell
   
   repeat with thisItem in droppedItems
       if (folder of (info for thisItem without size)) is true then
           list folder thisItem without invisibles
           
           repeat with thisFile in (result)
               tell application "QuickTime Player"
                   open ((thisItem as Unicode text) & thisFile)
                   
                   if (can export (front movie) as DV stream) is true then
                       try
                           export front movie to (exportFolder & thisFile & ".dv") as DV stream
                       on error errorMsg number errorNum
                           display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "OK" default button 1 with icon caution
                       end try
                   else
                       display dialog "QuickTime Player can't export “" & (thisFile as Unicode text) & "” as DV stream." buttons "OK" default button 1 with icon caution
                   end if
                   
                   close front movie
               end tell
           end repeat
           
           try
               tell application "Finder" to delete thisItem
           on error errorMsg number errorNum
               display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "OK" default button 1 with icon caution
           end try
       end if
   end repeat
   
   quit application "QuickTime Player"
end open


Filed under: QuickTime, Finder

Offline

 

#5 2005-12-05 03:44:59 pm

Duncan
Member
Registered: 2005-11-30
Posts: 3

Re: QuickTime Export Droplet

Wow! Thanks, Bruce! I'll check this out and let you know how it works!!!

Cheers, Duncan

Offline

 

#6 2006-12-18 03:25:38 pm

kevincbrock
Member
Registered: 2005-08-30
Posts: 67

Re: QuickTime Export Droplet

Bruce,

I too found the above-noted script quite handy. But I'd like to add one thing. I gave it a try and QT gave me an error "(8)". What I'd like to add is 2 additional prompts: I'd like to be asked to set an "Export to:" destination. And I'd like to be asked to select the particular quicktime export settings file too.

Hope you can help me...I'll attach my current script:

Applescript:

on run
   choose file with prompt "Select the file(s) to export:" with multiple selections allowed without invisibles
   open result
end run

on open droppedItems
   tell application "QuickTime Player"
       activate
       close every window
   end tell
   
   
   set saveLocation to (choose folder with prompt "Select destination for exported files:")
   
   set exportSetting to (choose file with prompt "Select the QT export settings file:")
   
   repeat with thisItem in droppedItems
       set thisName to name of (info for thisItem without size)
       
       tell application "QuickTime Player"
           open thisItem
           
           if (can export front movie as QuickTime movie) then
               try
                   export front movie to (saveLocation & thisName) as QuickTime movie ¬
                       using settings file alias (exportSetting)
               on error errorMsg number errorNum
                   display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "OK" default button 1 with icon caution
               end try
           else
               display dialog "QuickTime Player can't export “" & (thisFile as Unicode text) & "” as H.264." buttons "OK" default button 1 with icon caution
           end if
           
           close front movie
       end tell
   end repeat
   
   quit application "QuickTime Player"
end open


Filed under: QuickTime

Offline

 

#7 2006-12-19 02:19:57 pm

Bruce Phillips
Administrator
Registered: 2004-07-16
Posts: 2649

Re: QuickTime Export Droplet

I'm checking it out… Do you always want to export to a QuickTime movie?

Edit: Try something like this:

Applescript:

-- Try to save some default folders, so you don't jump back and forth for videos and settings file.
property chooseFileFolder : ""
property settingsFolder : ""

on run
   checkAlias(chooseFileFolder)
   choose file with prompt "Select the file(s) to export:" default location result with multiple selections allowed without invisibles
   set chosenFiles to result
   
   set chooseFileFolder to parentFolder(first item of chosenFiles)
   open chosenFiles
end run

on open theseItems
   choose folder with prompt "Choose destination for exported file(s):"
   set exportFolder to result as Unicode text
   
   checkAlias(settingsFolder)
   choose file with prompt "Choose the QuickTime export settings file:" default location result
   set exportSettingsFile to result
   set settingsFolder to parentFolder(exportSettingsFile)
   
   try
       tell application "QuickTime Player"
           activate
           close every window
       end tell
   end try
   
   repeat with thisItem in theseItems
       -- Use the original name for the exported file
       set {name:thisName, folder:isFolder} to (info for thisItem without size)
       
       -- Skip any folders that were dropped
       if not (isFolder) then
           -- Remove extension from original name, if any
           set ASTID to AppleScript's text item delimiters
           set AppleScript's text item delimiters to {"."}
           try
               set thisName to text 1 thru text item -2 of thisName
           end try
           set AppleScript's text item delimiters to ASTID
           
           tell application "QuickTime Player"
               try
                   open thisItem
                   
                   if (can export front movie as QuickTime movie) then
                       -- If the AppleScript takes too long (more than a minute) on a certain command, it will throw a timeout error.
                       -- Use a `timeout` block when something might take longer to finish.
                       with timeout of 86400 seconds -- 24 hours
                           export front movie to (exportFolder & thisName) as QuickTime movie using settings exportSettingsFile
                       end timeout
                   else
                       display dialog "QuickTime Player can't export “" & thisName & "” as a QuickTime movie." buttons {"Skip File"} default button 1 with icon caution
                   end if
               on error errMsg number errNum
                   if errNum is -2019 then set errMsg to "The export was canceled in QuickTime Player."
                   
                   display dialog "Error " & errNum & return & return & errMsg buttons {"Cancel Script", "Skip File"} default button 2
                   if (button returned of result) is "Cancel Script" then error number -128
               end try
               
               try
                   close front movie saving no
               end try
           end tell
       end if
   end repeat
   
   quit application "QuickTime Player"
   tell me to display dialog "Export script finished!" buttons {"View Export Folder", "OK"} default button 2 with icon note
   
   if (button returned of result) is "View Export Folder" then tell application "Finder" to open exportFolder
end open

on checkAlias(someItem)
   try
       return someItem as alias
   on error
       return path to home folder
   end try
end checkAlias

on parentFolder(someItem)
   set ASTID to AppleScript's text item delimiters
   set AppleScript's text item delimiters to {":"}
   try
       set someFolder to (text 1 thru text item -2 of (someItem as Unicode text)) & ":"
   on error
       set someFolder to ""
   end try
   set AppleScript's text item delimiters to ASTID
   return someFolder
end parentFolder


Filed under: QuickTime, Finder

Offline

 

#8 2006-12-20 12:11:17 pm

kevincbrock
Member
Registered: 2005-08-30
Posts: 67

Re: QuickTime Export Droplet

Bruce,
Thanks for the response. And to answer your intitial question, yes, in this circumstance I am always going to want to export to .mov.

I ran the script but it hang up and said, "The variable result is not defined." then pointed me to this section of script:

Applescript:


repeat with thisItem in theseItems
       -- Use the original name for the exported file
       set {name:thisName, folder:result} to (info for thisItem without size)

what do you think?
thanks for the help thus far, KB

Offline

 

#9 2006-12-20 01:16:54 pm

Bruce Phillips
Administrator
Registered: 2004-07-16
Posts: 2649

Re: QuickTime Export Droplet

kevincbrock wrote:

what do you think?


I think I need to dig up a QuickTime settings file and try it myself! roll

I fixed a few problems and made a few changes; See the edited version above.

Offline

 

#10 2006-12-20 03:20:01 pm

kevincbrock
Member
Registered: 2005-08-30
Posts: 67

Re: QuickTime Export Droplet

Bruce,
Thanks so much. I ran the script posted above and it seemed to worked fine for me. I ran it on a singular file - not a multiple selection. But it worked great. Thanks for your time & energy on this.
All the best, Kevin

Offline

 

#11 2008-03-13 08:27:42 pm

mannikin
Member
Registered: 2008-03-14
Posts: 3

Re: QuickTime Export Droplet

Hi Bruce,

I grabbed the script you had posted (which works great), but I'm new to Applescript, so please bear with me:

- I entered a path for the settings, but it still prompted me for the path.  Here is what I had entered: (H264 is the settings file I had exported from QT)
property settingsFolder : "/Users/john/Documents/H264"

- How do I make this script become a droplet, so all I need to do is drop a quicktime file onto it, have it read the path to the settings, and save the file to the same location with the same name but with a _H264 added to the name?

Appreciate the help. 

Thanks;
John

Browser: Firefox 2.0.0.12
Operating System: Mac OS X (10.4)

Offline

 

#12 2008-03-14 02:32:32 am

StefanK
Member
From:: St. Gallen, Switzerland
Registered: 2006-10-21
Posts: 11539
Website

Re: QuickTime Export Droplet

mannikin wrote:

property settingsFolder : "/Users/john/Documents/H264"


Hi,

AppleScript expects HFS paths (colon separated)

[code]property settingsFolder : "Mac HD:Users:john:Documents:H264:"[/code]


regards

Stefan

Offline

 

#13 2008-03-14 01:03:22 pm

mannikin
Member
Registered: 2008-03-14
Posts: 3

Re: QuickTime Export Droplet

Thank you! smile  That was very helpful. Managed to figure out the rest of my questions, except for this:

In the script, the name of the exported file is the same as the original name.  How do I add an extension, like _H264 to it?  Looking at the code, this is how the name is set:

set {name:thisName, folder:isFolder} to (info for thisItem without size)

Any help is appreciated.

Thanks;
John


StefanK wrote:
mannikin wrote:

property settingsFolder : "/Users/john/Documents/H264"


Hi,

AppleScript expects HFS paths (colon separated)

[code]property settingsFolder : "Mac HD:Users:john:Documents:H264:"[/code]

Offline

 

#14 2008-03-14 02:42:30 pm

Bruce Phillips
Administrator
Registered: 2004-07-16
Posts: 2649

Re: QuickTime Export Droplet

mannikin wrote:

In the script, the name of the exported file is the same as the original name.  How do I add an extension, like _H264 to it?


The file is specified as part of the export command. Try replacing the beginning of that with something like this:

Applescript:

export front movie to (exportFolder & thisName & "_H264")

Offline

 

#15 2008-03-14 02:52:10 pm

mannikin
Member
Registered: 2008-03-14
Posts: 3

Re: QuickTime Export Droplet

Thanks Bruce.  Appreciate the help.

I modified the script. It's now adding it after the .mov extension, so the file is now called <filename>.mov_H264, instead of <filename>_H264.mov

Also, the script complains if the exported filename already exists in that location.  Is there a way to override that, and just have it always write over an existing file?

Thanks;
J.


Bruce Phillips wrote:
mannikin wrote:

In the script, the name of the exported file is the same as the original name.  How do I add an extension, like _H264 to it?


The file is specified as part of the export command. Try replacing the beginning of that with something like this:

Applescript:

export front movie to (exportFolder & thisName & "_H264")

Offline

 

#16 2008-12-28 05:12:48 pm

jbrunson83
Member
Registered: 2008-12-28
Posts: 1

Re: QuickTime Export Droplet

Hi,

I'm pretty new to this.  I've tried using this script with a couple of modifications only to be stopped dead in my tracks.  I've trying to modify this to process thousands of sd2 files in descriptive folders to Wav (Quicktime's default settings are fine) to the same directory that the original file is from.  When I first got it to run using a modified version at the top of this page, I got it to work fine until it encountered a directory with any subfolders.

I then decided to modify it some more and pair it with automator with these actions:
-->Get Selected Finder Items
-->Get Folder Contents (with Repeat for each subfolder found checked
-->Open Finder Items (Opens with the applescript droplet that I'm including below)

Applescript:


on run
   choose file with prompt "Change audio files from these folders:" with multiple selections allowed
   open (result)
   
end run

on open droppedItems
   tell application "QuickTime Player"
       activate
       close every window
   end tell
   
   repeat with thisFile in droppedItems
       tell application "Finder"
           get folder of (thisFile) as Unicode text
           set workingDir to POSIX path of result
           
       end tell
       tell application "QuickTime Player"
           open (thisFile)
           if (can export (front document) as wave) is true then
               try
                   export front document to (workingDir & thisFile & ".wav") as wave
               on error errorMsg number errorNum
                   display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "OK" default button 1 with icon caution
               end try
           else
               display dialog "QuickTime Player can't export “" & (thisFile as Unicode text) & "” as Wave." buttons "OK" default button 1 with icon caution
           end if
           
           close front document
           
       end tell
   end repeat
   
   quit application "QuickTime Player"
end open

The problem that I'm having now is that it justs opens up the first file and just hangs there.  I have to do a force quit on Quicktime.

I could be making this way harder than it needs to be.  Any help will be very appreciated.  This is my first real time with applescript.

Best,
Jeremy

Model: iMac Intel 2.4 Ghz
AppleScript: 2.0.1
Browser: Safari 525.27.1
Operating System: Mac OS X (10.5)

Offline

 

#17 2008-12-30 09:10:17 pm

Sean Butler
Member
Registered: 2003-10-04
Posts: 5

Re: QuickTime Export Droplet

While I can't help with the last question - I do have one of my own.

I'm trying to convert to iPhone format and have setup a settings file as well as used the format explicitly in the script as follows:

export front document to (exportFolder & thisName & ".mv4") using most recent settings

and

export front document to (exportFolder & thisName & ".mv4") as iPhone

and

export front document to (exportFolder & thisName & ".mv4") as MPEG4

However, the exported file always results in a Quicktime file in a DV format. I convert a file with iPhone settings manually before trying the first statement. The second and third statements are valid formats in the Dictionary for the Quicktime player.

Any idea why this is not "sticking"?

Thanks,

Sean

Offline

 

#18 2009-01-14 02:43:04 pm

pinknoiz
Member
Registered: 2009-01-14
Posts: 1

Re: QuickTime Export Droplet

I just tried 'as iTunes' for the export setting and the videos plays on the iPod Touch. Even seems to work on systems that don't have Quicktime Pro enabled.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)