Go Back   The macosxhints Forums > Working with OS X > OS X Developer



Reply
 
Thread Tools Rating: Thread Rating: 4 votes, 5.00 average. Display Modes
Old 06-18-2010, 10:30 PM   #21
Cmd
Prospect
 
Join Date: Jun 2010
Posts: 3
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!
Cmd is offline   Reply With Quote
Old 06-19-2010, 06:39 PM   #22
capitalj
All Star
 
Join Date: Dec 2005
Location: Plymouth, Massachusetts
Posts: 630
Quote:
Originally Posted by Cmd
... 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
capitalj is offline   Reply With Quote
Old 06-20-2010, 02:46 PM   #23
Cmd
Prospect
 
Join Date: Jun 2010
Posts: 3
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!
Cmd is offline   Reply With Quote
Old 06-20-2010, 08:22 PM   #24
capitalj
All Star
 
Join Date: Dec 2005
Location: Plymouth, Massachusetts
Posts: 630
Quote:
Originally Posted by Cmd
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.
capitalj is offline   Reply With Quote
Old 10-27-2011, 12:06 AM   #25
switchstudios
Guest
 
Posts: n/a
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!
  Reply With Quote
Old 12-08-2011, 03:41 PM   #26
capitalj
All Star
 
Join Date: Dec 2005
Location: Plymouth, Massachusetts
Posts: 630
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
capitalj is offline   Reply With Quote
Old 01-29-2013, 02:53 AM   #27
Adam Wilson
Prospect
 
Join Date: Jan 2013
Posts: 1
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
Adam Wilson is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 07:03 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, 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.