I’m trying to add a few custom Cocoa objects into an Applescript Studio project and I’m looking for some comments from folks who have more experience than myself in this area.
The problem is as follows. I’ve got a custom application “log” system implemented as a couple of cocoa objects that I want to bolt neatly into my existing applescript studio application. The log system is viewed via a pretty straightforward NSTableView in a drawer. The log objects are instantiated in the NIB - this makes it easy to bind the table view to an array controller and then on to the log system itself. This is all easier to do in Cocoa than Applescript Studio and it all seems to work nicely (add a log comment, see it appear in the table view). So far, so good.
The problem comes in trying to extract a reference to the log object instantiated by the NIB so that I can add a log wrapper to use it in Applescript. Normally, in Cocoa, you’d add an outlet from some core object pointing to the log object and life would be good. However, there doesn’t seem to be (at least to me), an equivalent method for Applescript Studio. There just doesn’t seem to be a good way to get access to the object reference once the app is up and running.
I’ve got a kludgey workaround involving a class method and a static variable reference to the log object but this seems fairly ugly.
How do other folks work Applescript Studio references to custom cocoa objects that aren’t UI based and are instantiated when the NIB is loaded?
Many thanks in advance!