84672

Getting osascript to work with iPhone and QuickTime Player

Question:

I run this script and applescript can detect the devices just fine

tell application "QuickTime Player" video recording devices end tell

It gives a the reply below

{screen compression preset "FaceTime HD Camera" of application "QuickTime Player", screen compression preset "Gangzheng's iPhone" of application "QuickTime Player"}

But when I run my actual script

tell application "QuickTime Player" video recording devices set newMovieRecording to new movie recording tell newMovieRecording set current camera of newMovieRecording to "Gangzheng's iPhone" set current microphone of newMovieRecording to "Gangzheng's iPhone" start end tell end tell

it says QuickTime Player got an error: Can’t make "Gangzheng's iPhone" into type video recording device.

Is there a way to make applescript record anything from iPhone?

Answer1:

I had accomplished what you want to do, but in a different way because I also tried with

set current camera of newMovieRecording to "Gangzheng's iPhone"

but had no luck.... So here is my script for setting a camera

tell application "System Events" to tell process "QuickTime Player" #Set volume to 100% click button 1 of window 1 #To open dialog to show available cameras click button 3 of window 1 #To select our device click menu item "Gangzheng's iPhone" of menu 1 of button 3 of window 1 end tell

My script was a bit longer because I wanted to record the screen of my iphone at my MAC... So I had to set QuickTime Player to full screen, move mouse pointer outside the screen and so on...

tell application "Finder" set bigBounds to (get bounds of window of desktop) end tell tell application "QuickTime Player" activate start #Start new recording cmd + option + N tell application "System Events" to key code 45 using {option down, command down} set iBounds to (get bounds of front window) if bigBounds = iBounds then delay 1 else #Full screen only if is not already at full screen control + cmd + F tell application "System Events" to key code 3 using {control down, command down} delay 1 end if tell application "System Events" to tell process "QuickTime Player" #Set volume to 100% click button 1 of window 1 #To open dialog to show available cameras click button 3 of window 1 #To select our device click menu item "iPhone de User" of menu 1 of button 3 of window 1 end tell #To move mouse to the right side of the screen set mouseToolsPath to "/Users/Shared/MouseTools" set x to (item 3 of bigBounds) - 1 set y to (item 4 of bigBounds) / 2 #Por si el archivo no existe... try do shell script quoted form of POSIX path of mouseToolsPath & " -x " & (x as text) & " -y " & (y as text) on error errMsg number errNum display dialog "An unknown error occurred: " & errNum as text end try end tell

Hope it is helpful to someone.

Answer2:

barbudito, can you try this?

tell application "QuickTime Player" get video recording device "Gangzheng's iPhone" set newMovieRecording to new movie recording tell newMovieRecording start delay 10 do shell script "env" pause save newMovieRecording in "/Users/pmlg673f/Movies/test.mov" stop close newMovieRecording end tell end tell

Recommend

  • Applescript - move files to folder which name begins with first 7 characters of filename
  • applescript click menu bar option
  • applescript - control click
  • How to select speakers for iTunes from applescript
  • AppleScript: Error thrown when trying to read UI elements enabled
  • Swift - Get file path of currently opened document in another application
  • Result “Missing Value” with the JavaScript document.getElementById method
  • Applescript to show Apple menu bar items
  • Applescript to open an application in full-screen mode?
  • Applescript Excel 2016 save as PDF
  • How to avoid this Apple Siri https cracking scenario?
  • Scroll to anchor link in a Sammy.js project
  • How do I use SFSafariViewController with a dark theme like this user?
  • Grunt module(s) to upload all static assets to S3 / CloudFront, replace paths, and invalidate old as
  • Excel VBA Intersect
  • How to read data from a text file if the file location is not known in c#?
  • View/Download Pdf Files in React - Router 4
  • How do I include a SWC in an AS2 Flash project?
  • Can someone please explain to me in the most layman terms how to use EventArgs?
  • how to display data from 1st point on words on y axis for line chart in d3.js
  • WPF - CanExecute dosn't fire when raising Commands from a UserControl
  • How can I sort a a table with VBA with given text condition?
  • Display images in Django
  • Word Open XML Mail Merge
  • Row Count Is Returning the incorrect number using RaptureXML
  • WinForms: two way TextBox problem
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Proper folder structure for lots of source files
  • How to set the response of a form post action to a iframe source?
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • Understanding cpu registers
  • How do I configure my settings file to work with unit tests?
  • Change div Background jquery
  • How does Linux kernel interrupt the application?
  • Qt: Run a script BEFORE make
  • Linking SubReports Without LinkChild/LinkMaster
  • reshape alternating columns in less time and using less memory
  • How do I use LINQ to get all the Items that have a particular SubItem?