AppleScriptQuestions

Q: Click a menu option - can't figure out hierarchy

I am using Applescript to perform a number of image tasks. I am using my iPhone as the image capture device, however I am using QuickTime Player so I can see what the camera sees before I take the picture. The issue is that I need to close QuickTime Player and re-open it after every so many images.

 

I have the script accomplishing this right up until the point it displays this menu:

 

9634612.png

Now, I need it to automatically select the iPhone. I tried having the script simply use the up / down arrows twice and then push return, that works except that QuickTime likes to switch the order of the selections randomly.

 

Really, I simply need to know how to get the script to select based on name of the device. I will attach a screen shot of the Accessibility screen for that option as well:

 

795672345.png

Perhaps someone with some more UI experience than I can help me?

 

Thank you in advance!

MacBook Pro, OS X El Capitan (10.11.5)

Posted on Jul 10, 2016 3:19 PM

Close

Q: Click a menu option - can't figure out hierarchy

  • All replies
  • Helpful answers

  • by Pierre L.,

    Pierre L. Pierre L. Jul 11, 2016 8:07 AM in response to AppleScriptQuestions
    Level 5 (4,484 points)
    Jul 11, 2016 8:07 AM in response to AppleScriptQuestions

    Having got just one camera, I tried to select “Built-in Input:Line In” instead:

    xxx.png

     

    The following seems to work, although several seconds are needed before you can see the change:

     

    tell application "QuickTime Player"

         activate

         tell application "System Events"

               set theWindow to window 1 of process "QuickTime Player" whose subrole is "AXStandardWindow"

               click button 1 of theWindow

               keystroke "Built-in Input" & return

         end tell

    end tell