在系统对话框中激活和输入详细信息的脚本

Script to activate and enter details in System Dialog

我正在尝试编写一个可以在系统对话框中输入详细信息的脚本。但我无法访问它。有没有办法访问这个?我尝试获取所有系统对话框和警报的列表,但我仍然无法捕捉到它。

tell application "System Events" to ¬
  get name of every application process ¬
    whose role description of window 1 is "system dialog"

system dialog

我不确定以下是你要求的,但你自己试试:

tell application "System Events" to tell process "SecurityAgent"
    return name of every window
end tell
tell application "SecurityAgent"
    activate
end tell
tell application "System Events"
tell process "SecurityAgent"
    set value of text field 1 of window 1 to "Username"
    set value of text field 2 of window 1 to "Password"
    click button "Allow" of window 1
end tell
end tell