alfred-icloud-passwords icon indicating copy to clipboard operation
alfred-icloud-passwords copied to clipboard

Does not work on MacOS Ventura

Open SoloUnity opened this issue 2 years ago • 26 comments

SoloUnity avatar Jul 29 '22 00:07 SoloUnity

I'll get to this when I have a machine running Ventura. I guess since they overhauled the Settings app, my selectors for buttons and inputs don't work anymore.

leolabs avatar Jul 29 '22 13:07 leolabs

First, thanks for your work !

I also need it on Ventura.

Can you explain how do you find the selectors and I could modify it to work ?

robinalexandre avatar Aug 03 '22 08:08 robinalexandre

Hey @robinalexandre,

Thanks for your offer to take a look at this on Ventura! I mostly used Xcode's Accessibility Inspector to figure out the items to use, and did the rest using trial-and-error:

CleanShot 2022-08-05 at 18 09 36

leolabs avatar Aug 05 '22 16:08 leolabs

Did some digging and found you can open the password pane using

x-apple.systempreferences:com.apple.Passwords

image

SoloUnity avatar Sep 17 '22 07:09 SoloUnity

Yes I agree with you @SoloUnity, but the selectors to search for a specific password are still not working.

Can you have a look on this @leolabs ?

robinalexandre avatar Sep 21 '22 06:09 robinalexandre

I don't have a machine running Ventura yet but will take a look once I've upgraded.

leolabs avatar Sep 21 '22 12:09 leolabs

any update, on configuration on macos ventura?

Crushoverride007 avatar Oct 23 '22 04:10 Crushoverride007

any update, on configuration on macos ventura?

Crushoverride007 avatar Oct 23 '22 04:10 Crushoverride007

Not yet, maybe I should try to install Ventura on an external drive since I don't trust it enough to use it as my production OS yet.

leolabs avatar Oct 24 '22 01:10 leolabs

Exactly, i don't think it's worth it. for me personally i found it unstable for the time being.

Crushoverride007 avatar Oct 24 '22 01:10 Crushoverride007

Is there any update to this repo?

Crushoverride007 avatar Dec 20 '22 04:12 Crushoverride007

I made this script that works on macOS Ventura v 13.0.1, hopefully it works for you @Crushoverride007 @leolabs @robinalexandre @SoloUnity

on run argv
	# Open passwords window
	do shell script "open x-apple.systempreferences:com.apple.Passwords"
	
	set searchQuery to (item 1 of argv)
	
	tell application "System Events"
		set expireDate to (get current date) + 10
		repeat until ((window "Passwords" in process "System Settings") exists) or ((current date) > expireDate)
			delay 0.1
		end repeat
		if ((current date) > expireDate) then
			error "Find window timeout" number 100
		end if
		tell window "Passwords" in process "System Settings"
			tell group 1 of group 2 of splitter group 1 of group 1
				set expireDate to (get current date) + 10
				repeat until (first scroll area exists) or ((current date) > expireDate)
					delay 0.1
				end repeat
				if ((current date) > expireDate) then
					error "Find element timeout" number 100
				end if
				tell scroll area 1
					set value of first text field of group 3 to searchQuery
				end tell
			end tell
		end tell
	end tell
end run

marcoseiza avatar Jan 27 '23 19:01 marcoseiza

@marcoseiza it still doesn't work, it just opens up the password window. I've a similar script that does the exact same thing

Crushoverride007 avatar Jan 27 '23 21:01 Crushoverride007

Unfortunately, this doesn't seem to work for me either. It sometimes inserts the search query correctly but the list of passwords doesn't update. Might be an issue with the Settings app, but maybe we can work around that.

leolabs avatar Jan 27 '23 22:01 leolabs

Looking forward to Ventura support. following...

ejsuncy avatar Jan 27 '23 22:01 ejsuncy

Maybe it was because of a new update with Ventura but the script does work for me! Perhaps it hasn't worked consistently for everyone else because of the 10 second timer in the script?

SoloUnity avatar Feb 17 '23 07:02 SoloUnity

Thanks @marcoseiza , it works on Ventura 13.1. As @leolabs says, it always inserts query correctly, but sometimes the list doesn't update.

Please consider supporting query->copy->exit workflow.

Ti800 avatar Jun 08 '23 02:06 Ti800

Hoping for a fix soon 🤞🏼

bradydjohnson avatar Jul 26 '23 16:07 bradydjohnson

@bradydjohnson try changing my open shell script above to open x-apple.systempreferences:com.apple.Passwords-Settings.extension

I made this shortcut that gets the current url from your browser, in my case "Microsoft Edge Dev" and searches for it in your passwords. You can retrofit it to whatever your application is.

on run argv
	# Open passwords window
	do shell script "open x-apple.systempreferences:com.apple.Passwords-Settings.extension"
	
	# set searchQuery to (item 1 of argv)
	
	tell application "System Events"
		tell application "Microsoft Edge Dev"
			set searchQuery to URL of active tab of front window
		end tell
		set searchQueryClean to do shell script "echo '" & searchQuery & "' | sed -e 's/^http:\\/\\///g' -e 's/^https:\\/\\///g' | sed 's/\\/.*//g' "
		set expireDate to (get current date) + 10
		repeat until ((window "Passwords" in process "System Settings") exists) or ((current date) > expireDate)
			delay 0.1
		end repeat
		if ((current date) > expireDate) then
			error "Find window timeout" number 100
		end if
		tell window "Passwords" in process "System Settings"
			tell group 1 of group 2 of splitter group 1 of group 1
				set expireDate to (get current date) + 10
				repeat until (first scroll area exists) or ((current date) > expireDate)
					delay 0.1
				end repeat
				if ((current date) > expireDate) then
					error "Find element timeout" number 100
				end if
				tell scroll area 1
					set value of first text field of group 3 to searchQueryClean
				end tell
			end tell
		end tell
	end tell
end run

marcoseiza avatar Jul 26 '23 16:07 marcoseiza

Thank you!

Here's the code for anyone else that sees this

` on run argv # Open passwords window do shell script "open x-apple.systempreferences:com.apple.Passwords-Settings.extension"

set searchQuery to (item 1 of argv)

tell application "System Events"
	set expireDate to (get current date) + 10
	repeat until ((window "Passwords" in process "System Settings") exists) or ((current date) > expireDate)
		delay 0.1
	end repeat
	if ((current date) > expireDate) then
		error "Find window timeout" number 100
	end if
	tell window "Passwords" in process "System Settings"
		tell group 1 of group 2 of splitter group 1 of group 1
			set expireDate to (get current date) + 10
			repeat until (first scroll area exists) or ((current date) > expireDate)
				delay 0.1
			end repeat
			if ((current date) > expireDate) then
				error "Find element timeout" number 100
			end if
			tell scroll area 1
				set value of first text field of group 3 to searchQuery
			end tell
		end tell
	end tell
end tell

end run`

bradydjohnson avatar Jul 27 '23 19:07 bradydjohnson

Hey everyone, if anyone is still checking this. It broke for me after another update so I decided to check it out for myself. I messed around with the Xcode accessibility inspector and finally decided why complicate it for myself. My version script just types the query instead of inserting it, hope this helps someone. (Working on Sonoma 14.1)

on run argv
	do shell script "open x-apple.systempreferences:com.apple.Passwords"
	
	set searchQuery to (item 1 of argv)
	
	tell application "System Events"

		set expireDate to (get current date) + 10

		repeat until ((window "Passwords" in process "System Settings") exists) or ((current date) > expireDate)
			delay 0.1
		end repeat

		tell window "Passwords" in process "System Settings"
			tell group 1 of group 2 of splitter group 1 of group 1
				set expireDate to (get current date) + 10
				repeat until (first scroll area exists) or ((current date) > expireDate)
					delay 0.1
				end repeat
				if ((current date) > expireDate) then
					error "Find element timeout" number 100
				end if
				
				keystroke "a" using command down

				keystroke (ASCII character 8) -- ASCII character 8 is the backspace key

				keystroke searchQuery

			end tell
		end tell
	end tell
end run

SoloUnity avatar Nov 10 '23 09:11 SoloUnity

@SoloUnity unfortunately still not working, but can you tell me which version of alfred are you working with,

for the debuggers out there, here's the error i ge when i run the script of @SoloUnity to fetch the password of in this example of instagram.

CleanShot 2023-11-10 at 12 06 53@2x

Crushoverride007 avatar Nov 10 '23 11:11 Crushoverride007

@Crushoverride007 Using Alfred version 5.14 I have attached my version of the extension in case there is any configuration error. Also Alfred might be finicky with the accessibility settings? I had to turn that off and on in system settings before a previous version of the script worked.

iCloud Passwords.zip

SoloUnity avatar Nov 10 '23 17:11 SoloUnity

@SoloUnity I got it working as the one i had locally, but gotta that say it doesn't input the query i type it only opens up the passwords window without pasting the query i typed 😏 do you have any idea how to implement that, or is there a bug on the workflow?

Crushoverride007 avatar Nov 11 '23 17:11 Crushoverride007

Hi, is this working with the current versions? Are there any security concerns?

Sorka1 avatar Feb 21 '24 18:02 Sorka1

Would be great if you can check if #9 works for you :)

liuzikai avatar Feb 26 '24 22:02 liuzikai