Exporting Movie QuickTime Player By Running JXA Script


#1

I'm trying to get Keyboard Maestro to run a JXA script to capture a movie on QuickTime Player (10.5) Player and export.
I can start and stop the recording, but I'm having a problem with exporting.
I don't have a problem with Keyboard Maestro, but I thought Some JXA experts here could help.

qt = Application("QuickTime Player")
movie = qt.newMovieRecording()
qt.start(movie)
delay(3)
qt.stop(movie)
qt.export(movie, {in:Path("/Users/User_Name/test.m4v"), usingSettingsPreset:"720p"})

Export statement throws an error "Can't get object".
Any help would be appreciated.
Thanks!


#2

There are bugs in AppleScript that make saving and exporting with QuickTime a tricky process, and I’m not sure whether those bugs affect JXA. But if you don’t mind using AppleScript over JXA, I can show you how to do it with AppleScript.


#3

That would be great! Perhaps I could translate into JXA. Thanks!