Start and Save QuickTime screen recording with applescript

727 Views Asked by At

I have a very basic applescript that starts a QuickTime screen recording (or rather opens up the screen recording dialog box in QuickTime):

tell application "QuickTime Player"
    new screen recording
end tell

How do I make a second applescript that stops the screen recording and opens up a Save As... dialog box in QuickTime?

1

There are 1 best solutions below

0
JD_dev On

This is a simple example of how to accomplish stopping a recording already underway and present the Save... dialog box (note that most if not all versions of QuickTime Player have a Save... option and not Save As...)

tell application "QuickTime Player"
    new screen recording
    delay 5
    -- press record button
end tell

tell application "System Events"
    -- stop the recording
    key code 53 using {command down, control down}
    
    -- wait for recorded window to appear
    delay 5
    
    keystroke "s" using command down
end tell

The answer to your question is the second tell block but I included the first tell block so that you can run this script as is and see the entire process in action.

The delay in the second tell block is so that the Save... command is not fired before QuickTime Player finishes rendering the screen recording and opening the video in a window, otherwise the Save... dialog box won't appear in the foreground or possibly won't appear at all.

Ideally this script should be developed further to wait until the screen recording has been rendered and opened in a window, rather than using a delay, but it answers your question in the most basic form.