Applescript file dialog with UI scripting

匆匆过客 提交于 2019-12-07 12:56:31

问题


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?


回答1:


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


来源:https://stackoverflow.com/questions/2473091/applescript-file-dialog-with-ui-scripting

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!