带有 UI 脚本的 Applescript 文件对话框 [英] Applescript file dialog with UI scripting

查看:32
本文介绍了带有 UI 脚本的 Applescript 文件对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在应用程序的一个不太容易编写脚本的区域中打开一个文件.

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

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

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

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

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

推荐答案

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

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

这篇关于带有 UI 脚本的 Applescript 文件对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆