Setting a default program to open an rtf

Discussion in 'Mac Programming' started by sinecurea, Mar 11, 2009.

  1. sinecurea macrumors regular

    Mar 14, 2006
    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?

  2. Consultant macrumors G5


    Jun 27, 2007
    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.
  3. sinecurea thread starter macrumors regular

    Mar 14, 2006
    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. :)
  4. angelwatt Moderator emeritus


    Aug 16, 2005
    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

Share This Page