Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sinecurea

macrumors regular
Original poster
Mar 14, 2006
127
0
Northern Ireland
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?

Cheers!
S.
 

Consultant

macrumors G5
Jun 27, 2007
13,314
36
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.
 

sinecurea

macrumors regular
Original poster
Mar 14, 2006
127
0
Northern Ireland
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. :)
 

angelwatt

Moderator emeritus
Aug 16, 2005
7,852
9
USA
Through AppleScript you can use shell scripts. The following shows how to open a file in OpenOffice. There's no need to change defaults.

Code:
open -a OpenOffice.org.app file.name
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.