Applescript Help With Quicktime

Discussion in 'Mac Programming' started by macusertoday, Jun 4, 2013.

  1. macusertoday, Jun 4, 2013
    Last edited by a moderator: Jun 4, 2013

    macrumors newbie

    Jun 4, 2013
    Hello - I really need some Applescript help.

    I have a folder - let's call it :Macintosh HD:Users:MyUserocuments:Camera

    and this folder gets fed a series of jpegs throughout the day from a security camera. At the end of the day, I need to use Quicktime Pro 7 to create an Image Sequence movie from all the day's previous day's images. I then need to set that script to run after midnight each night.

    I have successfully done all of this using Automator, which activates and then copies all the files with yesterday's dates into a temp folder, launches QT and creates the .mov file, names it by date and deletes the temp folder. All of this works great.


    QT has a limit of 32,000 images that it can process, and some days, there are more than 32,000 images inside the Camera folder, which results in an error and an incomplete job.

    The problem I am having is, that Automator does not have a way to move a specific number of files from one folder to the next. I need an Applescript that will essentially look to see if there are > 32,000 files in the source Camera folder, and if there are, to move the first 32,000 files into temp folder A and the remainder into temp folder B. Then, I need something along the lines of what I have below, but different in that it needs to launch QT, create 2 image sequence movies, save them as Temp1 and Temp2 (by experience, if you don't save them before merging, QT will quit) and then merge (copy one into the other) the two files, and name it with the date logic below.

    Any help with this would be really great!

    I use Automator to select the folder and moves the files the temp folder. The portion of the automator workflow that deals with this is an Applescript:

    on run {input, parameters}
    set theFolder to input
    tell application "Finder" to set theSequence to first item of folder theFolder as alias
    set {month:m, day:d, year:y} to (current date) - days
    set dateFormat to (y * 10000 + m * 100 + d) as string
    set theDate to (text items 5 thru 6 of dateFormat as string) & "-" & (text items 7 thru 8 of dateFormat as string) & "-" & (text items 3 thru 4 of dateFormat as string)
    set nameSequence to theDate
    with timeout of (30 * 60) seconds
    tell application "QuickTime Player 7"
    open image sequence theSequence frames per second 6
    tell document 1 to save self contained in "Macintosh HD:Users:MyUserocuments:Camera
    " & nameSequence
    end tell
    end timeout
    tell application "Finder" to delete theFolder
    end run

Share This Page