set thisinfo to get default application of (info for myFile)
I can only get the default app. I am unable to change the default application for files based on extension. Any ideas?
Handler, use as droplet, or modify.
on open (these_items)
tell application "System Events"
repeat with this_item in these_items
set default application of file (this_item as text) to (path to application "BBEdit")
end repeat
end tell
end open
[P.S. I can’t test anymore, as I’ve managed to make BBEdit the default for all text documents on my machine now.]
Hi,
all parameters of info for are read only.
Use System Events instead. According the dictionary default application is settable
Thanks for the useful info.
Thanks Fenton for the script.
Oops!! Actually, I want to change the default application for all files having a particular extension.
if i use
tell application “System Events”
set default application of file thefile to theapp
end tell
then only default application of that file will be changed–not all files having that same extension.
From the dictionary:
default application (disk item) : the application that will launch if the file is opened
Any ideas?
I could well be wrong on this as its been a far old while since I had to trash this file but the the info regarding file opening preferences is in user library prefs ‘com.apple.LaunchServices.plist’ if you can change via script then I would expect to see this file updated/modified.