The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   OS X Developer (http://hintsforums.macworld.com/forumdisplay.php?f=27)
-   -   Applescript Quicktime Open Image Sequence (http://hintsforums.macworld.com/showthread.php?t=63657)

Cmd 06-18-2010 11:30 PM

Thank you capitalj!

That worked great. The only thing is I might have not explained myself correctly when it comes to naming the file. I want it to be the same as the folder that I'm selecting that contains the files. So right now the script names it the name of the first file in the folder and saves it in the folder. So I want it to be named the folder name and saved in the same directory as the folder.

The way it is right now is very useful but if I could get it that way that I just explained, that would really save me a lot of time.

Thanks Again!

capitalj 06-19-2010 07:39 PM

Quote:

Originally Posted by Cmd (Post 586618)
... The only thing is I might have not explained myself correctly...

You explained yourself fine, I remember reading it. I don't know why I left that part out. There are probably cleaner ways to do this, but...

Code:

tell application "Finder"
                set theFolder to input as alias
                set thePath to container of theFolder as string
                set theName to name of theFolder
                set theSequence to (get first file of theFolder as alias)
        end tell
       
       
        tell application "QuickTime Player 7"
                activate
                open image sequence theSequence
               
                set imageSequence to thePath & theName & ":" & theName & ".mov"
               
                tell document 1
                        with timeout of 500 seconds
                                save self contained in imageSequence
                        end timeout
                       
                        close
                       
                end tell
        end tell


Cmd 06-20-2010 03:46 PM

Excellent!!! It worked! Thanks! This is going to save me so much time.

The only thing I changed was where it saves it. I took out " ":" & theName " so that it saves the movie in the same directory as the folder. In my case, it's better because if there are hundreds of images, I'll have to scroll to find it. That's no fun. I'm sure that in some cases it would be better the other way though.

Thanks Again!

capitalj 06-20-2010 09:22 PM

Quote:

Originally Posted by Cmd (Post 586769)
The only thing I changed was where it saves it.

Well, you did say "… saved in the same directory as the folder". I guess it's time to get in the habit of wearing my reading glasses.

switchstudios 10-27-2011 01:06 AM

CapitalJ you are a life-saver!!

This is exactly the workflow I have been working for! Hooray!

Unfortunately I cannot get the revised script you posted that renames the imageSequence to the name of the folder to work with a dropped folder. I cut and pasted two of your scripts together and perhaps I have screwed up somehow?? Seems like it should work, but not getting anything....

What works (but doesn't rename):

on adding folder items to thisFolder after receiving droppedFolders
repeat with aFolder in droppedFolders

tell application "Finder" to set theSequence to (get first file of aFolder as alias)

tell application "QuickTime Player"
activate
open image sequence theSequence

set nameSequence to (theSequence as string) & ".mov"

tell document 1
with timeout of 900 seconds
export to nameSequence as QuickTime movie using most recent settings
end timeout

close saving no

end tell
end tell

end repeat
end adding folder items to


What doesn't work:

on adding folder items to thisFolder after receiving droppedFolders
repeat with aFolder in droppedFolders

tell application "Finder"
set theFolder to input as alias
set thePath to container of theFolder as string
set theName to name of theFolder
set theSequence to (get first file of theFolder as alias)
end tell

tell application "QuickTime Player"
activate
open image sequence theSequence

set imageSequence to thePath & theName & ".mov"

tell document 1
with timeout of 1800 seconds
export to imageSequence as QuickTime movie using most recent settings
end timeout

close saving no

end tell
end tell

end repeat
end adding folder items to

I have taken the liberty of increasing the timeout interval since some of my sequences are quite long and QT was choking, but otherwise I think this should work. Only it doesn't... What am I missing?

Thanks so much!

capitalj 12-08-2011 04:41 PM

Try this. (change "QuickTime Player 7" to "Quicktime Player" for pre-Snow Leopard.)

Code:

on adding folder items to thisFolder after receiving droppedFolders
        repeat with aFolder in droppedFolders
               
                tell application "Finder"
                        set theFolder to aFolder as alias
                        set thePath to container of theFolder as string
                        set theName to name of theFolder
                        set theSequence to (get first file of theFolder as alias)
                end tell
               
                tell application "QuickTime Player 7"
                        activate
                        open image sequence theSequence
                       
                        set imageSequence to thePath & theName & ".mov"
                       
                        tell document 1
                                with timeout of 1800 seconds
                                        export to imageSequence as QuickTime movie using most recent settings
                                end timeout
                               
                                close saving no
                               
                        end tell
                end tell
               
        end repeat
end adding folder items to


Adam Wilson 01-29-2013 03:53 AM

Resurection of fantastic script thread
 
Hi
This is my first post here.
I'm using the script that capitalj posted as a folder action within automator.

It's working beautifully, but.... There is always a but..
It won't let me drop multiple folders or a directory folder in it. If I do the script won't run and it just sits there.

I've got thousands of consecutively named folders with 10,000 consecutive jpegs in them.

What I would like to do is drop a directory folder into the "action" folder and have the movies saved in a separate
folder in the "action" folder called 'movies'
Here's the script I'm using;

on run {input, parameters}
repeat with theFolder in input
tell application "Finder"
set theFolder to input as alias
set thePath to container of theFolder as string
set theName to name of theFolder
set theSequence to (get first file of theFolder as alias)
end tell


tell application "QuickTime Player 7"
activate
open image sequence theSequence

set imagesequence to thePath & theName & ":" & theName & ".mov"

tell document 1
with timeout of 500 seconds
save self contained in imagesequence
end timeout

close

end tell
end tell
end repeat
end run


Any input would be hugely appreciated.
Adam


All times are GMT -5. The time now is 05:50 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.