Applescript running slowly what is " focused"

Thank you, help me to delete the post, I gave up the idea

Just curious – don’t mean to be intrusive – what are you doing? Why do you need this script?

To me it isn’t clear either what exactly you are trying to do.

It would be helpful if you post your code as text, so that we can copy/paste and try it.

1 Like

I typed the code into SD6 and it fails.

System Events got an error: Can’t get sheet 1 of window "iCloud" of process "System Preferences". Invalid index.

Probably because I’m on Sierra and @leo said they are on Yosemite. I assume the pref pane has changed.

Since you have already typed the whole code, do you mind to post it here? :wink:


tell application "System Preferences"
	set current pane to pane id ""
	tell application "System Events"
		tell process "System Preferences"
			tell scroll area 1 of sheet 1 of window "iCloud"
				tell group 1 of UI element 1
					set focused of pop up button 1 of group 3 to true
					click pop up button 1 of group 3
					delay 0.2
					key code 125
					delay 0.2
					key code 36
				end tell
			end tell
		end tell
	end tell
end tell

In the OP’s screen shot there is a spurious character “a” on the 5th line from the bottom – not sure what that’s about.

The “iCloud” window elements in SD6 Explorer looking at System Events does not seem to match up with the elements in the code … again, probably a Sierra vs. Yosemite diff that I’m seeing.

probably, yes.

Any idea, what he means with “I want to creat icloud e-mail”?

Ticking/unticking the Mail checkbox in the iCloud pane? That’s the only reference to “Mail” I see there; but must be something, you would like to change often, no? Nobody would set up a script for one-time tasks…

It must be something with “Manage Family”. The only sheet with a scroll area I see is after hitting the “Manage Family” button…

Anyway, going to bed now :slightly_smiling_face:

I think it’s the iCloud login screen in System Preferences – what you get before logging in to the scree you are looking at, @Tom. Here’s what it looks like in Yosemite

As @leo said,

the 1 page(Create apple id,The first step, a total of three steps)

So they are automating a process to create an AppleID.

Not sure why that’s needed … unless one wants to create numerous AppleIDs for some … purpose … :smirk:

1 Like


Attempting to create AppleIDs in bulk is likely to run into Apple’s fraud protection and risk locking out the accounts for a period. Even it a macro could be written to do this (no doubt, it can) merely testing the macro could trigger the anti-fraud controls. If AppleIDs need to be created in bulk for educational or corporate use it is best to not use the consumer channel and contact Apple’s education or corporate support organizations.