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

Pep*_*ijn 3 applescript

我试图在一个不太可编写的应用程序区域中打开一个文件.

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

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

mcg*_*ilm 8

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

   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
Run Code Online (Sandbox Code Playgroud)