0

I've been trying for weeks to script an ipad restore process for Apple Configurator 2. My script works fine when ran within Script Editor, and it also works as a stand alone application. The problem occurs when my script is launched from a Calendar event (which is the whole idea so I don't have to run it manually). Here is the first part of my script:

tell application "Apple Configurator 2" activate delay 30 tell application "System Events" tell process "Apple Configurator 2" keystroke "a" using {command down} delay 5 click menu item "1 - Erase" of menu 1 of menu item "Apply" of menu 1 of menu bar item "Actions" of menu bar 1 delay 5 click button "Apply" of sheet 1 of window "All Devices" end tell end tell 

The script triggers just fine, and all is working until it attempts to click the "Apply" button. My script application returns this error: Can't get window "All Devices" of <> "Apple Configurator 2" of application "System Events".

System Events got an error: Can't get window "All Devices" of process "Apple Configurator 2". (-1728)

As an Applescript newbie, I'm out of ideas. Anybody else? Thanks!

1 Answer 1

1

Code does not work as is. I have tested this and it works.

tell application "Apple Configurator 2" activate delay 30 tell application "System Events" keystroke "a" using {command down} delay 5 click menu item "1 - Erase" of menu 1 of menu item "Apply" of menu 1 of menu bar item "Actions" of menu bar 1 delay 5 click button "Apply" of sheet 1 of window "All Devices" end tell end tell 
3
  • Please keep me updated. Commented Sep 20, 2016 at 22:39
  • Hmm, not able to get as far as before. Now I get "Can't get <<class mbar>> 1 of application "System Events". System Events got an error: Can't get menu bar 1. (-1728) Commented Sep 21, 2016 at 17:16
  • Which would make sense because menu bar 1 would belong to Configurator not System Events, right? Commented Sep 21, 2016 at 17:21

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.