[Openmcl-devel] mac filetype association
arthur.cater at ucd.ie
Wed Feb 3 12:19:52 PST 2016
Thanks Ron and thanks Paul,
Yes I’m on a mac, sorry I thought I’d said but I see I didn’t.
Plenty of homework for me huh. I’ve barely started.
Can anyone hint where I’d find how it is arranged that a double-click on a file
causes ccl to invoke the Hemlock editor? I actually want a development system
but there’s a particular kind of file I’d like treated other than by Hemlock.
(Yes I’d done the Get Info thing, I’ll look gratefully at what Paul provided)
> On 3 Feb 2016, at 19:31, Paul Krueger <plkrueger at comcast.net> wrote:
> On Feb 3, 2016, at 11:34 AM, Arthur Cater <arthur.cater at ucd.ie> wrote:
>> Hi, I’d like to get an application (built with ccl) to open when a file of a particular filetype
>> is double-clicked, and I can do that. However I’d like it to do something other than
>> open a Hemlock window for the file. I’ve tried to (advise ed … :when :around) but that does not
>> do the trick, presumably somewhere other than ED needs such advice. Please … advise!
>> Openmcl-devel mailing list
>> Openmcl-devel at clozure.com
> There are a variety of different things that you might be trying to do (each with its own difficulties). If you want to try Ron’s suggestion, I have attached a pdf that contains my own notes on how toplevel functions work. If you are doing a fairly simple single-purpose app, that could work. If you are you doing a custom gui app on a mac it can get a lot more complicated.
> The rest of this assumes you are on a mac, so disregard if that isn’t the case.
> When you said that you could get your app to open your file type, I can imagine a couple of ways you might have done that. You might have just done a “Get Info" on a file of that type and then told it to open up your app by default for that file type. That’s fairly easy. The more standard way for a new application to do that is to modify the info.plist file in its application bundle. When that bundle is saved or loaded as an application the OS will record the association declared in the info.plist file and thereafter open any files of that type by that app. That’s a better way to go because you can then copy your app to another computer which will then know to open your app when those files are double-clicked.
> The other reason to change the info.plist is that you can associate an NSDocument Class with your file and an instance of that class will be created when your file is opened. Then that class and its associated methods will determine what happens (i.e. how your file is loaded and displayed, etc.) That can add its own sorts of complexity.
> If you are more ambitious, I created an extensive contrib that contains tools that let you build cocoa applications with your own file types, display windows, and actions. It creates application bundles and populates them as you specify with an interactive window. It has support for saving and restoring any document files that you define in the same way that other Mac apps do. The contrib also contains extensive support for data type conversions that you might want to do for Cocoa apps. It does take some effort to understand everything, but if you want to build your own app with its own bundle, etc. I believe that this is a relatively easy way to go. Look for "CCL Cocoa Developer Tools Tutorial.pdf” in the CCL distribution and it will walk you through the entire process.
More information about the Openmcl-devel