Created
March 25, 2014 03:30
-
-
Save pwc3/9754730 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set appleID to "ENTER YOUR APPLE ID HERE" | |
activate application "Xcode" | |
tell application "System Events" | |
tell process "Xcode" | |
-- open the preferences dialog | |
click menu item "Preferences…" of menu "Xcode" of menu bar 1 | |
-- find and select the Accounts tab | |
set found to false | |
repeat with aButton in buttons of toolbar 1 of window 1 | |
if name of aButton is equal to "Accounts" then | |
set found to true | |
click aButton | |
end if | |
end repeat | |
-- bail if we couldn't find it | |
if not found then | |
display alert "Could not find \"Accounts\" tab in preferences window" | |
return | |
end if | |
-- find and select the cell with the specified Apple ID | |
set found to false | |
repeat with aRow in row of table 1 of scroll area 1 of window 1 | |
if name of first UI element of aRow is equal to appleID then | |
set found to true | |
select aRow | |
end if | |
end repeat | |
-- bail if we couldn't find it | |
if not found then | |
display alert "Could not find \"" & appleID & "\" in preferences window" | |
return | |
end if | |
-- if the details sheet isn't already open... | |
if (count of sheets of window 1) is 0 then | |
-- find and click "View Details..." | |
set found to false | |
repeat with aButton in buttons of group 1 of window 1 | |
if name of aButton is equal to "View Details..." then | |
set found to true | |
click aButton | |
end if | |
end repeat | |
if not found then | |
display alert "Could not find \"View Details...\" button" | |
return | |
end if | |
end if | |
-- find the Refresh and Done buttons | |
set refreshButton to missing value | |
set doneButton to missing value | |
repeat with aButton in buttons of sheet 1 of window 1 | |
if description of aButton is equal to "refresh" then | |
set refreshButton to aButton | |
else if name of aButton is equal to "Done" then | |
set doneButton to aButton | |
end if | |
end repeat | |
-- bail if either could not be found | |
if refreshButton is missing value then | |
display alert "Could not find Refresh button" | |
return | |
end if | |
if doneButton is missing value then | |
display alert "Could not find Done button" | |
return | |
end if | |
-- click the Refresh button | |
click refreshButton | |
delay 3 | |
-- click the Done button | |
click doneButton | |
delay 0.5 | |
-- close the Preferences window | |
keystroke "w" using command down | |
end tell | |
end tell | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment