apple script quicktime player export permission error
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.
MacBook Pro 13", macOS 10.14