Created
February 4, 2021 21:24
-
-
Save jeffbargmann/c2a2ead45d0c52efce7248fcf5ae9e68 to your computer and use it in GitHub Desktop.
Generates 4 digit pin from a given passphrase, enters it in to keyboard.
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
# The purpose of this script is to generate/enter a ScreenTime PIN so that you don't have memory of it. | |
# To use, paste into Script Editor, open up ScreenTime PIN protection dialog on macOS, and leave pincode entry screen up. | |
# Switch back to Script editor and wait. This script will generate pin and place it in. | |
# Repeat process for PIN confirmation. | |
# You can recorver pin later by executing the script in TextEdit/similar. | |
# I strongly recommend you enable a backup account in case you lose this. | |
set passwd to "PASSWORD_GOES_HERE" | |
set passwordAsciiSum to stringToAsciiSum(passwd) + 10000 as string | |
set pincode to text -4 thru -1 of passwordAsciiSum | |
delay 2 | |
tell application "System Events" | |
keystroke pincode | |
end tell | |
delay 0.1 | |
tell application "System Events" | |
keystroke return | |
end tell | |
on stringToAsciiSum(str) | |
set sum to 0 | |
repeat with char in characters of str | |
set sum to sum + (the ASCII number char) | |
end repeat | |
return sum | |
end stringToAsciiSum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment