Reputation: 911
I'm using the following AppleScript to determine when the user clicks the stop recording button in the task bar:
tell application "QuickTime Player"
tell document 1
activate
new screen recording
delay 1
tell application "System Events" to key code 49
delay 2
repeat until (new screen recording) is false
end repeat
end tell
end tell
Though instead the script keeps relaunching QuickTime.
Upvotes: 1
Views: 175
Reputation: 7191
You can put the result of the new screen recording
command into a variable.
Use the exists command to check this document
tell application "QuickTime Player"
activate
set tdoc to new screen recording --> document "Screen Recording"
delay 1
tell application "System Events" to key code 49
delay 2
repeat while exists tdoc
delay 1
end repeat
-- the recording is stopped
tell front document
-- do something with the front document ("Untitled")
end tell
end tell
Upvotes: 1