Macos 如何在Mac OS 10.10 Yosemite中的AppleScript中获得对话框焦点

Macos 如何在Mac OS 10.10 Yosemite中的AppleScript中获得对话框焦点,macos,dialog,applescript,osx-yosemite,Macos,Dialog,Applescript,Osx Yosemite,我编写了一个简单的脚本,让Active Directory用户安装网络访问所需的特定密钥链。我已经在10.7-10.9上成功地使用了它,并且指令提示很好 当10.10出现时,“激活”命令不再将程序带到前端。相反,在钥匙链访问出现后,AppleScript图标会在码头上疯狂反弹 代码如下: activate display dialog "Welcome to the Mac Network Cerificate Installer (Version 6.0)" & return &

我编写了一个简单的脚本,让Active Directory用户安装网络访问所需的特定密钥链。我已经在10.7-10.9上成功地使用了它,并且指令提示很好

当10.10出现时,“激活”命令不再将程序带到前端。相反,在钥匙链访问出现后,AppleScript图标会在码头上疯狂反弹

代码如下:

activate
display dialog "Welcome to the Mac Network Cerificate Installer (Version 6.0)" & return & return & "Click Okay to start installation of the Mac Network Certificate. Please wait until the next dialog box shows up." with icon file "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:Bonjour.icns" buttons {"Okay"} default button 1 with title "WONK"

delay 2

activate application "Keychain Access"

tell application "Finder" to open POSIX file "/Files/bn-virtualcar.crt"

delay 2

activate
display dialog "In the Keychain Access prompts, click the 'Add' then 'Always Trust'." & return & return & "After you have entered your password, close Keychain Access by clicking 'Keychain Access' in the top left corner and selecting Quit." with icon file "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:Bonjour.icns" buttons {"Okay"} default button 1 with title "WONK"

delay 2

tell application "System Events" to delete login item "Mac-Network-Cert"
在上有一个类似的问题,但它不适用于我,因为这些不是密码提示或shell脚本。我只想显示两个说明框


任何帮助都将不胜感激

您的对话框应如下所示,以确保焦点,或将其插入 发现者告诉了我们

tell application "SystemUIServer"
    activate
    display dialog "Welcome to the Mac Network Cerificate Installer (Version 6.0)" & return & return & "Click Okay to start installation of the Mac Network Certificate. Please wait until the next dialog box shows up." with icon file "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:Bonjour.icns" buttons {"Okay"} default button 1 with title "WONK"
end tell

delay 2

activate application "Keychain Access"

tell application "Finder" to open POSIX file "/Files/bn-virtualcar.crt"

delay 2
tell application "SystemUIServer"

    activate
    display dialog "In the Keychain Access prompts, click the 'Add' then 'Always Trust'." & return & return & "After you have entered your password, close Keychain Access by clicking 'Keychain Access' in the top left corner and selecting Quit." with icon file "System:Library:CoreServices:CoreTypes.bundle:Contents:Resources:Bonjour.icns" buttons {"Okay"} default button 1 with title "WONK"
end tell
delay 2

tell application "System Events" to delete login item "Mac-Network-Cert"

请注意:我尝试过将“激活”改为“告诉我激活”,但没有成功。这听起来有点胡闹——除了可能出错之外,鼓励用户随机安装一些软件并不是培养的最安全的习惯。但如果是公司网络,你不能/不应该通过ARD推出证书吗?您可以尝试苹果的ARD论坛,例如,这里有一个先前的讨论:
certtool
看起来尤其像是你应该研究的东西。你是对的,这是一种很好的方法。但目前,我的双手被我被迫使用的证书的性质所束缚。在我的IT组端(我是另一个部门)的证书得到修复和更新之前,我无能为力。谢谢。当我还在努力让这个证书在system.keychain级别上运行时,这是一个很好的解决方法,可以将它放入login.keychain。