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