Setting a default program to open an rtf

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

  1. macrumors regular

    Joined:
    Mar 14, 2006
    Location:
    Northern Ireland
    #1
    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.
     
  2. macrumors G5

    Consultant

    Joined:
    Jun 27, 2007
    #2
    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. thread starter macrumors regular

    Joined:
    Mar 14, 2006
    Location:
    Northern Ireland
    #3
    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. Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #4
    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
     

Share This Page