So I've been using a script before I updated to Catalina that worked fine for screen recording. It's based on another user's SE question, but ever since the update, it looks like there is a new step.
Basically, you tell "QuickTime Player" to start (new screen recording).
But instead of a screen recording starting, it just opens a new menu which lets you select some settings, or click the screen to record using the last used settings.
I've tried using System Events to click to screen, even after a 1s delay, but it's not working.
Anyone know how to either:
1) Bypass the new menu and just start recording right away
2) Start recording once the menu has popped up (System Events doesn't detect window 1, so I'm not even sure how to navigate the UI)
3) Click the screen/UI using System Events
* Update to question *
I've edited my AppleScript code since user3439894 wrote a response. It seems to work for what I've asked. The only problem now is that I'm not sure how to save to file to a specific path. Below, I've added some code snippets of what I currently have since making edits (it just saves the screen recording to the Desktop based on the date for the time. Below that, I have my original code which saves it on the Desktop as test.mov
.
My code now, after edits
1) Starting recording
tell application "QuickTime Player" to activate
tell application "QuickTime Player" to start (new screen recording)
tell application "System Events" to tell process "Screen Shot"
repeat until exists its front window
delay 0.1
end repeat
if not (exists button "Record" of its front window) then
click checkbox "Record Entire Screen" of its front window
end if
click button "Record" of its front window
end tell
2) end recording
tell application "System Events" to click menu bar item 1 of menu bar 1 of application process "screencaptureui"
My Code Before Edits
3) Old way I used to start my recording before Catalina for screen recording (still works for webcam (aka Movie) recording)
tell application "QuickTime Player" to activate
tell application "QuickTime Player" to start (new screen recording)
4) Old way I used to stop and save my screen recording that doesn't work in Catalina
set filePath to "Users:mini:Desktop:test.mov"
set f to a reference to file filePath
tell application "QuickTime Player"
pause document "screen recording"
save document "screen recording" in f using settings preset "1080p"
stop document "screen recording"
close document "screen recording"
end tell
Best Answer
Without seeing your AppleScript code, all I can say is that for me, as an example, on macOS High Sierra doing a screen recording requires different coding then on macOS Catalina, as the latter no longer actually uses QuickTime Player to do the actual screen recording.
This may also hold true for macOS Mojave, however, the following example AppleScript code was only tested under macOS Catalina:
At this point, by default, when the screen recording is stopped, it is saved to the Desktop as e.g. Screen Recording 2019-11-01 at 3.38.00 PM.mov on my system and opened in QuickTime Player.
Additional coding can be included to do whatever else one would like to do with the screen recording (within the limits of the target app and AppleScript).
That all said, since macOS Catalina is actually using a different application to do the actual screen recording and not QuickTime Player, one could skip the use of QuickTime Player and create the screen recording using the following example AppleScript code, which uses the system default keyboard shortcut ⇧⌘5:
%
instead of5
inkeystroke "%"
as the shift key is pressed and I'm on a US English keyboard.Note: The example AppleScript code is just that and does not contain any additionally error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors.