QuickTime Export

Hi “ can anyone help me with the following (folder action) lines and tell me what is wrong with it, cause it seems that it doesn’t want to work “ I’m a new in Applescript, so thanks for any corrections.

Greetings, Simon

on adding folder items to thisfolder after receiving thisitem
	tell application "QuickTime Player"
		if QuickTime Pro installed is false then
			error "This script requires a QuickTime Pro installation on this system."
		else
			open thisitem
			if (can export (front movie) as ThreeGPP) is true then
				export front movie to (thisfolder & thisitem & "_mobile.3gp") as ThreeGPP using most recent settings
			else
				display dialog "QuickTime Player can't export this file" buttons "OK" default button 1 with icon caution
			end if
		end if
	end tell

	quit application "QuickTime Player"
end adding folder items to

Hi fulk,

In this part:

(thisfolder & thisitem & “_mobile.3gp”)

you’re trying to create a file specification. thisfolder is a reference, thisitem is a list, and “_mobile.3gp” is a string. When you concatenate you want all strings or at least the first item a string. I would also coerce your thisitem variable to a string also.

gl,

I can’t test it right now, but you can try this:

on adding folder items to thisFolder after receiving addedItems
	tell application "QuickTime Player"
		activate
		close every window
		
		if QuickTime Pro installed is false then ¬
			display dialog "This script requires QuickTime Pro." buttons {"Cancel"} default button 1 with icon stop
		
		repeat with thisItem in addedItems
			try
				open thisItem
				if (can export (front movie) as ThreeGPP) is true then
					get -2 - (count (name extension of (info for thisItem without size)))
					get (text 1 thru (result) of (thisItem as Unicode text)) & "_mobile.3gp"
					
					export front movie to (result) as ThreeGPP using most recent settings
				else
					display dialog "QuickTime Player can't export "" & (thisItem as Unicode text) & ""." buttons {"OK"} default button 1 with icon caution
				end if
			on error errorMsg number errorNum
				display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons {"OK"} default button 1 with icon caution
			end try
		end repeat
		
		quit
	end tell
	
	beep 2
end adding folder items to

Also. it’s not a folder action, but you may be interested in this thread.

thanks for the replies; I changed the code now but it still does not want to work; maybe someone else has another good idea to.


on adding folder items to thisfolder after receiving addedItems
	tell application "QuickTime Player"
		activate
		close every window
		
		if QuickTime Pro installed is false then ¬
			display dialog "This script requires QuickTime Pro." buttons {"Cancel"} default button 1 with icon stop
		
		repeat with thisitem in addedItems
			try
				open thisitem
				if (can export (front movie) as ThreeGPP) is true then
					export front movie to desktop as ThreeGPP using most recent settings
				else
					display dialog "QuickTime Player can't export "" & (thisitem as Unicode text) & ""." buttons {"OK"} default button 1 with icon caution
				end if
			on error errorMsg number errorNum
				display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons {"OK"} default button 1 with icon caution
			end try
		end repeat
		
		quit application "QuickTime Player"
		
	end tell
end adding folder items to

What I do is export to a file specification (doesn’t exist yet). You don’t need QuickTime Pro also. You can try the following and modify it for your fa.

set m to choose file – choose a movie
set dp to (path to desktop) as string
set fs to (dp & “_mobile.3gp”) as file specification
with timeout of 10 * minutes seconds
tell application “QuickTime Player”
launch
activate
open m
tell front movie
stop
rewind
export to fs as ThreeGPP using most recent settings
end tell
end tell
end timeout

Try testing out the exported movie.

gl,