Benches macOS

2

apple script quicktime player export perm…

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

I am trying to trim a movie and then save it.

tell application "QuickTime Player"
	activate
	set theMovie to open file "Users:me:Documents:myFolder:example.mp4"
	trim theMovie from 0 to (1 * 60 + 10.75)
	export front document in "Users:me:Documents:myFolder:output.mov" using settings preset "1080p"
end tell

But in Quicktime player in the export progress I get an error:

The file couldn’t be saved because you don’t have permission. You don’t have permission.

The folder and everything in it has read and write access for every user "chmod -R 777 myFolder".

Even if I run the script with "sudo osascript myScript.scpt" I get the same permission error.

Why do I get this error and how can I export the trimmed clip? Simple save can also only save it as ".qtpxcomposition" file extension. Other file extensions also give errors.

2 replies

Sign in or join Beachball Help to reply.

  1. 0

    Hadus

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    export front document in "Users:me:Documents:myFolder:output.m4a" using settings preset "Audio Only"
    

    works but any other preset fails with error.

    I also tried:

    export front document in file "Users:me:Documents:myFolder:output.mov" using settings preset "1080p"
    

    and then got a different error:

    The operation could not be completed An unknown error occurred (-12780)
    

  2. 0

    Hadus

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    tell application "QuickTime Player"
    	activate
    	set inFile to "Users:me:Documents:myFolder:input.mp4"
    	set outFile to "Users:me:Documents:myFolder:output.mp4"
    
    	try
    		set theOpenedFile to open for access file outFile with write permission
    		set eof of theOpenedFile to 0
    	end try
    
    	open file inFile
    	trim front document from 0 to (0 * 60 + 2)
    	export front document in outFile using settings preset "1080p"
    
    	try
    		close access theOpenedFile
    	end try
    
    	close every document saving no
    end tell
    

    Is working :)