开发者

Automate open dialog box

Is there any way to automate a opening files with open dialog box on Mac OS? The application asks user to open files with the standard open dialog box. But I need open files automatically.

The idea is to write开发者_运维百科 script or a small application which will click the button in the target application to open dialog box and then somehow select files which I needed. But I don't know how can I do it. Any suggestions will be very appreciated.


If you already know what file(s) you want to open, then the open file dialog box is usually bypassed completely by the target application.

You'll have to look at the Dictionary for your target application to see if the Open command is defined. If an application is scriptable, then that's going to be one the basics, though each implementation will vary slightly.

If an application doesn't have a Dictionary, you can use the Finder to open the file:

tell application "Finder"
    set theApplication to "Path:To:Application.app" as alias
    set theFile to "Path:To:File.ext" as alias
    open theFile using theApplication
end tell
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜