Skip to content

Instantly share code, notes, and snippets.

@crowjdh
Created March 11, 2022 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crowjdh/ce8cfb33282e1db79f789c3e20752dfb to your computer and use it in GitHub Desktop.
Save crowjdh/ce8cfb33282e1db79f789c3e20752dfb to your computer and use it in GitHub Desktop.
Open Keychain/Sublime Text(or any editor), select first item, run the script
openKeychain()
-- Count how many entries you have, or just pick one.
-- Having excessive number won't hurt.
repeat 300 times
tell application "System Events" to keystroke return
copyPastePlainTexts()
copyPastePassword()
openKeychain()
tell application "System Events" to keystroke "w" using command down
tell application "System Events" to key code 125
delay 1
end repeat
on copyPastePlainTexts()
repeat 3 times
tabCopy()
openSublime()
pasteReturn()
openKeychain()
end repeat
end copyPastePlainTexts
on copyPastePassword()
openPassword()
tabCopy()
openSublime()
pasteReturn()
tell application "System Events" to keystroke return
end copyPastePassword
on openPassword()
repeat 4 times
delay 1
tell application "System Events" to keystroke tab using shift down
end repeat
tell application "System Events" to keystroke space
delay 1
tell application "System Events" to keystroke "YOUR_PASSWORD_HERE"
tell application "System Events" to keystroke return
delay 1
end openPassword
on openKeychain()
tell application "Keychain Access"
activate
delay 1
end tell
end openKeychain
on openSublime()
-- Use your favorite text editor
tell application "Sublime Text"
activate
delay 1
end tell
end openSublime
on tabCopy()
tell application "System Events" to keystroke tab
tell application "System Events" to keystroke "c" using command down
end tabCopy
on pasteReturn()
tell application "System Events" to keystroke "v" using command down
tell application "System Events" to keystroke return
end pasteReturn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment