2010-03-18 28 views
2

我想在应用程序的不太可编写脚本的区域中打开文件。使用UI脚本的Applescript文件对话框

通过使用UI脚本选择适当的菜单项,我得到了一半,但是这打开了一个标准文件对话框。

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

+0

什么应用程序是我们能看到你已经尝试了什么? – mcgrailm 2010-03-19 12:21:28

+0

Safari,文件下的导入书签对话框。到目前为止,我只做了一个简单的点击“条”的“菜单”的“项目”或类似的东西,这工作正常。 – Pepijn 2010-03-19 14:27:34

+0

你想做什么?将书签导入Safari?如果是这样,你最好将.plist直接导入到用户的目录中,而不是通过Safari的GUI。 – markratledge 2010-03-19 18:17:15

回答

6

啊确定这应该让你去正确的道路

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 
+0

我同意songdogtech,但这是你如何设置目标文件夹 – mcgrailm 2010-03-19 18:21:37