开发者

Applescript file dialog with UI scripting

开发者 https://www.devze.com 2022-12-23 03:53 出处:网络
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 开发者_JAVA百科dialo

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 开发者_JAVA百科dialog.

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号