AppleScript quicktime to record iPhone screen

applescriptquicktime

I am looking for a an Apple Script to tell Quicktime Player to start a new recording of the attached iPhone (so record an app doing its thing) and with the specified audio input.

Is this even possible?

Thanks

Best Answer

Is it possible? Maybe. First I tried:

 tell application "QuickTime Player"    
    set current camera to video recording device named "My Name's iPhone"
    end tell

and I got an error that the current camera could not be set to that. I also tried to set it back to "FaceTime HD Camera" and QuickTime Player did not like that either.

Next I tried:

tell application "QuickTime Player"
    set theRecording to new movie recording
    set theDocument to its document "Movie Recording"
    tell theDocument
        set current camera to video recording device named "FaceTime HD Camera"
        start
    end tell
end tell

But still got an error when trying to set the current camera property.

So the closest I could come was to set the camera and audio manually, and QuickTime Player should remember those settings. So then you can just use this script to start the recording. Although to be honest, it doesn't really do what couldn't be done with the same amount of button clicks in QuickTime Player itself!

tell application "QuickTime Player" 
    set theRecording to new movie recording
    set theDocument to its document "Movie Recording"
    tell theDocument
        start
    end tell
end tell

That does not completely answer your question, since I could not set the video and audio sources for the new movie. The AppleScript dictionary for QuickTime Player that the "current camera" property of the document "new recording" should be able to be set by AppleScript. So possibly someone smarter than me can figure out how to set it.