Dear Macscripter,
I am trying to get the name of every key in the current keychain, which I have done successfully, all apart from the fact that a dialog pops up from the process “Keychain Scripting” which asks the user to click “Allow” which is button 2. I was trying to use GUI scripting to click this button as below:
tell application "Keychain Scripting"
set theKeyList to name of every key of current keychain
repeat with x from 1 to (length of theKeyList)
if name of key x of current keychain does not contain "Safari" then
try
set thePassword to password of key x of current keychain
-- setting thePassword needs to happen without waiting for it to end
tell application "System Events"
tell process "Keychain Scripting"
tell window 1
click button 2
end tell
end tell
end tell
end try
end if
end repeat
end tell
But I have a problem. The line “set theURL to name…” waits for the user to click allow before moving to the next line to click the button with GUI scripting, by which time it is too late. After a search on this forum, I decided to try:
tell application "System Events"
tell process "Keychain Scripting"
set theKeyList to name of every key of current keychain
repeat with x from 1 to (length of theKeyList)
if name of key x of current keychain does not contain "Safari" then
try
set thePassword to password of key x of current keychain
tell window 1
click button 2
end tell
end tell
end tell
end try
end if
end repeat
end tell
The above doesn’t work because it doesn’t know what “key” means - “Expected class name but found property.”
I’m really hoping that somebody can help me to click this button automatically.
Thanks,
Lambo