I'm trying to write a JavaScript Automation script for recording the screen on my Mac. I'm finding that the API is broken at the line that is doc.close()
. QuickTime just hangs there and eventually my Script Editor fails with a timeout error.
var QuickTime = Application("QuickTime Player");
var doc = QuickTime.newScreenRecording();
doc.start();
delay(2);
doc.close();
I eventually have to quit QuickTime from the command line with the following:
$ killall QuickTime\ Player
Then I open QuickTime again to find my video waiting for me there. So then I decided to add the arguments the close method and now my script looks like this:
var QuickTime = Application("QuickTime Player");
var doc = QuickTime.newScreenRecording();
doc.start();
delay(2);
doc.close("yes",Path("/Users/myuser/Desktop/movie.mov"));
QuickTime.quit();
Result:
Error -2700: Script too silly to execute.
Error on line 5: Error: Named parameters must be passed as an object.
I don't see enough documentation out there to completely understand when is being asked of me here. What is the proper way to write this script that capture a screen recording and saves that document/file to my Desktop?