Last active
December 29, 2015 03:49
-
-
Save pmbuko/7610346 to your computer and use it in GitHub Desktop.
This is how ADPassMon opens the Change Password dialog box in OS X.
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
| --this first line gets the x in os version 10.x | |
| set osVersion to (do shell script "sw_vers -productVersion | awk -F. '{print $2}'") as integer | |
| tell application "System Preferences" | |
| try -- this won't work if UI scripting is not enabled | |
| set current pane to pane id "com.apple.preferences.users" | |
| activate | |
| tell application "System Events" | |
| tell application process "System Preferences" | |
| if osVersion is less than or equal to 6 then | |
| click radio button "Password" of tab group 1 of window "Accounts" | |
| click button "Change Password…" of tab group 1 of window "Accounts" | |
| end if | |
| if osVersion is greater than 6 then | |
| click radio button "Password" of tab group 1 of window "Users & Groups" | |
| click button "Change Password…" of tab group 1 of window "Users & Groups" | |
| end if | |
| end tell | |
| end tell | |
| on error theError | |
| display dialog theError | |
| end try | |
| end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment