带有 UI 脚本的 Applescript 文件对话框

发布于 2024-08-26 02:50:59 字数 117 浏览 6 评论 0原文

我正在尝试在应用程序的不可编写脚本的区域中打开文件。

我通过使用 UI 脚本来选择正确的菜单项,但这会打开一个标准文件对话框。

如何使用 Applescript 设置文件对话框的目标位置?

I am trying to open a file in a not so scriptable area of an application.

I got halfway there by using UI scripting to select the proper menu item, but this opens a standard file dialog.

How can I set the destination of the file dialog with Applescript?

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

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

发布评论

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

评论(1

是伱的 2024-09-02 02:50:59

啊,好吧,这应该会让你走上正确的道路

   tell application "Safari"
    activate
    -- do menu select gui script first
    set posixpath to "/path/to/a/folder/that/exists"
    tell window 1
        tell application "System Events"
            keystroke "g" using {shift down, command down}
            keystroke posixpath
            delay 1
            keystroke return
        end tell
    end tell
   end tell

ahh ok this should get you going on the right path

   tell application "Safari"
    activate
    -- do menu select gui script first
    set posixpath to "/path/to/a/folder/that/exists"
    tell window 1
        tell application "System Events"
            keystroke "g" using {shift down, command down}
            keystroke posixpath
            delay 1
            keystroke return
        end tell
    end tell
   end tell
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文