• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to set application which opens a file via Applescript?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to set application which opens a file via Applescript?


  • Subject: Re: How to set application which opens a file via Applescript?
  • From: Yvan KOENIG <email@hidden>
  • Date: Sun, 30 Aug 2015 16:11:09 +0200


Le 2015/08/30 à 13:04, S. J. Cunningham <email@hidden> a écrit :


On Aug 30, 2015, at 6:52 AM, Yvan KOENIG wrote:


Le 2015/08/30 à 12:36, S. J. Cunningham <email@hidden> a écrit :

You can change the application which opens a file via "Get Info" but how can you do it via Applescript?

Changing the "file type", "file creator," and "original item" properties via a finder script doesn't do it.  I notice that when you change it using "Get Info" the "kind" property changes but that property is "read only" to the finder script.

Steve

I'm not sure that I understand well your question.
Maybe this may help :

set aFile to (path to desktop as text) & "erreur Numbers.rtf"

set path2app to path to application id "com.barebones.textwrangler"
tell application "Finder" to open file aFile using path2app

It opens the text file in TextWrangler. Replace the id by the BBEdit one to achieve your goal.

Sorry I wasn't clear.  Using your example, I want to permanently change the application which opens "erreur Numbers.rtf" to textwrangler when I double-click on it from the finder.  I don't want to open "erreur Numbers.rtf" via a script.

I can change this via "Get Info" from the finder but I would like to change it via a script.

Hope that's more clear :)

Steve


Oops, I wrongly posted directly to your mailbox.

I see no other way than GUI Scripting.

set aFile to (path to desktop as text) & "erreur Numbers.rtf" as alias

tell application "Finder"
open information window of aFile
end tell
tell application "System Events" to tell process "Finder"
tell first window to tell first scroll area
set popUp to first pop up button
click popUp
--name of menu items of menu 1 of popUp
click menu item "LibreOffice.app (5.0.1002)" of menu 1 of popUp
end tell
end tell


Yvan KOENIG running Yosemite 10.10.5 in French (VALLAURIS, France) dimanche 30 août 2015 16:09:59




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to set application which opens a file via Applescript?
      • From: Yvan KOENIG <email@hidden>
References: 
 >How to set application which opens a file via Applescript? (From: "S. J. Cunningham" <email@hidden>)
 >Re: How to set application which opens a file via Applescript? (From: "S. J. Cunningham" <email@hidden>)

  • Prev by Date: Re: How to set application which opens a file via Applescript?
  • Next by Date: Re: How to set application which opens a file via Applescript?
  • Previous by thread: Re: How to set application which opens a file via Applescript?
  • Next by thread: Re: How to set application which opens a file via Applescript?
  • Index(es):
    • Date
    • Thread