【问题标题】:"ask for text" action in Apple automator does not receive focus automaticallyApple automator 中的“请求文本”操作不会自动获得焦点
【发布时间】:2012-08-25 11:41:44
【问题描述】:

我使用 Apple 的 Automator 编写了一个服务。第一个动作是“询问文本”动作。但是,当我触发启动服务的快捷方式时,弹出询问文本的模式,但它没有焦点。我必须用鼠标点击它。

有什么方法可以让自动机打开这个窗口,重点放在文本输入上?

【问题讨论】:

  • 这一刻让我发疯了。我会做更多的研究,如果没有爱,我会开始赏金。

标签: macos automator


【解决方案1】:

使用以下代码将一些 applescript 添加到工作流程的顶部。只需将 myapp 替换为您的应用名称即可

tell application "myapp"
activate
end tell

【讨论】:

  • 你也可以单独使用'activate'。
  • 我在工作流的顶部添加了一个 AppleScript 操作,它只是“激活”并且它可以工作。谢谢!
【解决方案2】:

这是一种对我有用的部分答案;我没有使用 Ask for text 操作,而是在我的 automator 应用程序中使用了一个 applescript(而不是 Ask..action,我使用了“Run applescript”操作)。它看起来像这样:

on run {input, parameters}

    set x to the text returned of (display dialog "Enter a version number" default answer "1134" buttons {"OK"} default button 1)


    return x
end run

我的 lil' automator 应用程序是帮助我输入票证的版本号;使用鼠标使我的手受伤。 applescript 对话框似乎有正确的焦点,所以享受吧!让我们知道你的表现!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多