hoody Posted June 11, 2016 Share Posted June 11, 2016 In 1Password, there is a type called "Passwords", which saves passwords only. It seems the Alfred 1Passwords integration only works with the "Logins" type password. But sometimes, I only need to get a password I saved before. I would like Alfred to copy the password to the clipboard. For example, I need to login MySQL database from terminal, but I don't remember the password. I would like to fire alfred to copy the password from 1Password. Is there a way to do it? Thanks. Link to comment
FroZen_X Posted June 11, 2016 Share Posted June 11, 2016 (edited) In 1Password, there is a type called "Passwords", which saves passwords only. It seems the Alfred 1Passwords integration only works with the "Logins" type password. But sometimes, I only need to get a password I saved before. I would like Alfred to copy the password to the clipboard. For example, I need to login MySQL database from terminal, but I don't remember the password. I would like to fire alfred to copy the password from 1Password. Is there a way to do it? Thanks. Umm the way how i do it is, opening 1password with a search term and then send keycodes to it via applescript. Here is an example for a game called league of legends: https://www.dropbox.com/s/dus9sxywxv4dw9i/1password%20mini.alfredworkflow?dl=0 Keep in mind that 1password has to be unlocked before you start. To change it to your use, just change this applescript part: open location "x-onepassword-helper://search/league" delay 1 Gotta have to check how your what your stuff is exactly name. Just replace "league" with your term. Then you have to take a look at the next applescript that's called: tell application "System Events" to tell process "1Password mini" set frontmost to true key code 124 delay 1 key code 36 end tell For a normal login copy it does press "Right arrow" and then "Return" after a delay. For your case you gotta have to add "key code 126" and then press "Return" i guess like this: tell application "System Events" to tell process "1Password mini" set frontmost to true key code 124 delay 1 key code 126 delay 1 key code 36 end tell Gotta have to play with the delay and see what's the best. Here is a website for all the possible key codes. Maybe someone else knows a better way, but that's how i do it atm ^^ Hope this helps Edited June 11, 2016 by FroZen_X Petru 1 Link to comment
muyexi Posted February 27, 2017 Share Posted February 27, 2017 (edited) I created one workflow to find and copy password in the 1Password app. Edited September 25, 2018 by muyexi Link to comment
dr00 Posted September 20, 2018 Share Posted September 20, 2018 The above method stopped working with 1Password 7 because 1Password mini no longer exists. Here's an updated AppleScript which should help others. open location "onepassword://extension/search/{query}" tell application "System Events" to tell process "1Password 7" set frontmost to true delay 0.7 key code 48 delay 0.2 key code 124 delay 0.2 key code 125 delay 0.2 key code 36 end tell Basically this opens the "mini" like app that actually runs as an extension in the main 1Password 7 process, inputs the query from the first object (or you can hard code it to search for a specific app), sends the tab key code to select the first search result, sends right arrow to select the username, sends down arrow to select password, and sends return key to copy it to the clipboard. Petru 1 Link to comment
delikat Posted October 20, 2019 Share Posted October 20, 2019 I made a version that's a bit faster and also restores focus to the frontmost app when called. You may need to add in some delays. https://github.com/delikat/alfred-workflows/raw/master/1Password Copy.alfredworkflow tell application "System Events" set frontmostApplicationName to name of 1st process whose frontmost is true open location "onepassword://extension/search/{query}" set frontmost of process "1Password 7" to true key code 48 key code 124 key code 125 key code 36 set frontmost of process frontmostApplicationName to true end tell Link to comment
dp1207 Posted May 12, 2020 Share Posted May 12, 2020 This is great. Is there any way to pop-up a list of so I know when my search has reduced to a single item? On 10/19/2019 at 8:08 PM, delikat said: I made a version that's a bit faster and also restores focus to the frontmost app when called. You may need to add in some delays. https://github.com/delikat/alfred-workflows/raw/master/1Password Copy.alfredworkflow tell application "System Events" set frontmostApplicationName to name of 1st process whose frontmost is true open location "onepassword://extension/search/{query}" set frontmost of process "1Password 7" to true key code 48 key code 124 key code 125 key code 36 set frontmost of process frontmostApplicationName to true end tell henrik 1 Link to comment
nachii Posted January 22, 2021 Share Posted January 22, 2021 Hi, here there is my version: https://github.com/nachii/alfred-1password-direct-copy-workflow I hope it will be useful🙂 gelbander and cands 2 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now