Using automator, this script works on Ventura. First enable screen mirroring in the menu bar.
Create an automator (osascript had issues sending key commands from terminal) to run an applescript and save it (Here on my Desktop)
# open chrome
tell application "Google Chrome"
open location "http://192.168.68.xxx:9330/display/"
activate
end tell
delay 1
# set full screen
tell application "System Events"
keystroke "f" using {command down, control down}
end tell
-- Click the “Screen Mirroring” menu bar item.
set timeoutSeconds to 2.0
set uiScript to "click menu bar item 6 of menu bar 1 of application process \"Control Center\""
my doWithTimeout(uiScript, timeoutSeconds)
-- Click the “Roku TV” checkbox.
delay 1
set timeoutSeconds to 2.0
set uiScript to "click checkbox 2 of scroll area 1 of group 1 of window \"Control Center\" of application process \"Control Center\""
my doWithTimeout(uiScript, timeoutSeconds)
on doWithTimeout(uiScript, timeoutSeconds)
set endDate to (current date) + timeoutSeconds
repeat
try
run script "tell application \"System Events\"
" & uiScript & "
end tell"
exit repeat
on error errorMessage
if ((current date) > endDate) then
error "Can not " & uiScript
end if
end try
end repeat
end doWithTimeout
Next the TriggerCMD is just
automator /Path/To/File