View Full Version : Setting a default program to open an rtf

Mar 11, 2009, 09:45 AM
Hi Folks,
When You right click a file and select Open With -> Other and you can select "Always open with", is there a way to do the same with Apple Script or Java?

Our program needs to open rtf files in MS Word by default - I'd prefer to be able to set this ourselves once confirming with the user.

Any ideas?


Mar 11, 2009, 10:01 AM
If doing the thing you listed doesn't work, you can drag the file onto the app you want to open with.

For example, drag the rtf onto the word icon in dock.

Mar 11, 2009, 10:14 AM
I think you misunderstand me. Your suggestion does not change any defaults.
I'm looking to change the default application of a rtf via Java or Apple Script.

Our program will create an rtf file and launch it - we can't automatically open it in Word, unless Word is the system default for rtf. So we need to let the user tick a box in our app, and I'm looking to then set Word as the default so the user doesn't have to go through all the motions themselves. :)

Mar 11, 2009, 10:53 AM
Through AppleScript you can use shell scripts. The following shows how to open a file in OpenOffice. There's no need to change defaults.

open -a OpenOffice.org.app file.name