So I have an app (iclipapp.com) that can run applescripts. I want to add an option to open the scripts in an editor. By default, I want to check if the user has SD installed, and then open that, otherwise fall back to Apple’s Script Editor.
So I thought I’d use LaunchServices and ask for the SD app by its bundle ID. But it turns out that SD’s bundle ID appears to keep changing, i.e. it has a version number in the bundle ID! So that’s not great for my purpose.
Another way would be to find apps that can handle a particular file extension, with the role “editor”. Looking at SD 7’s supported extensions, “.scptd” appears to be one of them.
Now I wonder: how far back is that type supported, and is it planned to remain?
Or is there a smarter way to do this?
(later) Huh, I had thought that “scptd” would be a SD specific extension, but it turns out that Apple’s SE knows it, too. So I guess I could just look for the default editor for the to-be-edited file (with LSCopyDefaultApplicationURLForURL
or [NSWorkspace URLForApplicationToOpenURL:]
) and use that to open the script file. That way, the user can assign his preferred editor for the scpt file in Finder and I don’t have to worry further about giving more options.