Basic Applescript - How to launch file with default program?

Discussion in 'Mac Programming' started by adrian.jfl, Aug 28, 2007.

  1. macrumors newbie

    Joined:
    Aug 28, 2007
    #1
    Hi,

    I want to open a file (say a .txt) with it's default Finder program
    association (eg textedit).. I have an application that doesn't support
    applescript but will still launch if I double click on it's associated
    files.. I'd like to be able to launch them from applescript.

    Thanks,
    Adrian.
     
  2. macrumors 68040

    MongoTheGeek

    Joined:
    Sep 13, 2003
    Location:
    Its not so much where you are as when you are.
    #2
    tell application "Finder" open file "Myfile.txt" of desktop

    -or-

    do shell script "open ~/desktop/myfile.txt"

    -or-

    tell application "myNonScriptableApp" to open posix file "/Users/me/desktop/myfile.txt"

    All applications even non scriptable ones respond to open, activate, quit, and launch.
     

Share This Page