Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bufordtaylor/e68901f1a302bcd9dc2a813a54d68d16 to your computer and use it in GitHub Desktop.
Save bufordtaylor/e68901f1a302bcd9dc2a813a54d68d16 to your computer and use it in GitHub Desktop.
Fill in system password dialogs from 1Password
-- Change E27 to a unique string that will find your system password in 1Password
do shell script "open x-onepassword-helper://search/E27"
-- Give 1Password a smidge of time to open
delay 0.5
-- Copy the password to the clipboard (1Password will auto clear it after 90 seconds)
tell application "System Events" to keystroke "c" using {shift down, command down}
-- Give 1Password a smidge of time to copy
delay 0.5
-- Focus the system password dialog
tell application "SecurityAgent" to activate
-- Open ForcePaste, an app that types out your clipboard using virtual keyboard events
-- Secure system dialogs don't allow you to paste into them normally
do shell script "open /Applications/Force\\ Paste.app"
-- Delay a smidge as Alfred loses focus when activating via a Workflow
delay 0.5
-- Uncomment this line to press enter after pasting.
-- I didn't do this in case I accidently activated this while in Messages, Slack, etc.
-- There's no safeguard to prevent it from sending your system password to whoever you're chatting with.
-- tell application "System Events" to keystroke return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment