在 OS X 上更改窗口焦点

发布于 2024-09-04 12:10:29 字数 378 浏览 7 评论 0原文

作为 OS X 上 InstallationCheck 脚本的一部分,需要使用查找器对话框来让用户浏览文件。完成后,我想再次将安装程序应用程序移到前面,以便用户可以轻松地继续安装。

我已经尝试过简单的方法:

tell application "Installer" to activate

这不起作用,因为只要我在脚本内,安装程序应用程序就没有响应,当我尝试激活它时,applescript 将尝试等待,直到安装程序响应,从而有效锁定程序,直到 InstallationCheck 脚本超时。

所以基本上我需要一种方法来集中应用程序,即使它当前没有响应也能工作。有什么方法可以从 applescript 或直接从 perl 脚本执行此操作吗?

As part of an InstallationCheck script on OS X I need to use finder dialogs to let the user browse for files. When I'm done I want to move the installer application up front again so that the user can easily continue with the installation.

I have already tried the simple:

tell application "Installer" to activate

This does not work because as long as I am inside the script the Installer application is unresponsive and when i try to activate it the applescript will try to wait until Installer responds, effectively locking the program until the InstallationCheck script times out.

So basically I need a way to focus an application that works even if it is currently unresponsive. Is there any way to do this either from an applescript or directly from the perl script?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

落花随流水 2024-09-11 12:10:29

尝试一下

 ignoring application responses
    tell application "Installer" to activate
 end ignoring

你也可以尝试这样的事情

 tell application "System Events"
    set installer to application file of application processes whose name is "Installer"
 end tell
 tell application "Finder" to open installer

try

 ignoring application responses
    tell application "Installer" to activate
 end ignoring

you could also try something like this

 tell application "System Events"
    set installer to application file of application processes whose name is "Installer"
 end tell
 tell application "Finder" to open installer
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文