Created
April 20, 2019 05:03
-
-
Save slmingol/781e5eaeb87c24e50a55ad5064cd528f to your computer and use it in GitHub Desktop.
Example AppleScript to Reset Advertising Identifier on macOS under System Preferences -> Security & Privacy
This file contains 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
#!/bin/bash | |
### REF: https://apple.stackexchange.com/questions/357209/automating-reset-advertising-identifier-is-it-possible/357211?noredirect=1#comment471757_357211 | |
osascript << END | |
if running of application "System Preferences" then | |
try | |
tell application "System Preferences" to quit | |
on error | |
do shell script "killall 'System Preferences'" | |
end try | |
end if | |
repeat while running of application "System Preferences" is true | |
delay 0.01 | |
end repeat | |
tell application "System Preferences" | |
activate | |
reveal anchor "Privacy" of pane "com.apple.preference.security" | |
end tell | |
tell application "System Events" to tell application process "System Preferences" | |
repeat while not (exists (window "Security & Privacy")) | |
delay 0.1 | |
end repeat | |
select row 12 of table 1 of scroll area 1 of tab group 1 of window "Security & Privacy" | |
repeat while not (exists (button "Reset Advertising Identifier" of group 1 of tab group 1 of window "Security & Privacy")) | |
delay 0.1 | |
end repeat | |
click button "Reset Advertising Identifier" of group 1 of tab group 1 of window "Security & Privacy" | |
repeat while not (exists (button "Reset identifier" of sheet 1 of window "Security & Privacy")) | |
delay 0.1 | |
end repeat | |
click button "Reset identifier" of sheet 1 of window "Security & Privacy" | |
repeat until not (exists (sheet 1 of window "Security & Privacy")) | |
delay 0.1 | |
end repeat | |
end tell | |
quit application "System Preferences" | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment