代码之家  ›  专栏  ›  技术社区  ›  MatsT

在OS X上更改窗口焦点

  •  0
  • MatsT  · 技术社区  · 16 年前

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

    我已经尝试过简单的:

    tell application "Installer" to activate
    

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

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

    1 回复  |  直到 16 年前
        1
  •  3
  •   mcgrailm    16 年前

    尝试

     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