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

查看:724
本文介绍了与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天全站免登陆