How to ensure Applescript dialog focus in OS X 10.10 (Yosemite)?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Before OS X 10.10 (Yosemite), I could ensure an applescript dialog had focus by telling the "current application" to activate: tell current application activate set output to (do shell script "printf '" & hostsLine & commentString & "' >> /private/etc/hosts" with administrator privileges) end tell This would bring the password dialog to the front to type in. The dialog no longer appears with focus in Yosemite and you have to click on it before you can type. Searching on stack exchange and elsewhere hasn't provided any solutions/workarounds.