views:

60

answers:

1

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.

A: 

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
Philip Regan
Thanks for reply. Unfortunately, it does not work for me. The application is the Flash application inside the browser.
Andrey M.
What *exactly* are you trying to do here? The question itself is a bit self-contradictory but now you are going onto a completely different tangent. Are you asking about the Flash plug-in (which we can't do anything about) or do you have an SWF file that you want to view (which none of the above will help you with)? Neither scenario is addressed in your question.
Philip Regan