Phil,
You might want to consider using the following three classes which are all Objective-C classes and can be used together. The following three classes are all from the OSAKit:
1. OSAScriptView, The "view" of model-view-controller (MVC) 2. OSAScriptController, The "controller" of model-view-controller and 3. OSAScript, The "model" of model-view-controller.
I agree with you that the documentation appears to be nonexistent. If you had to, you could sign up for the paid Mac Developer Program at Apple and get 2 tech-support incidences.
It is possible to use either OSAScript or NSAppleScript as the model to compile and run AppleScript code in Cocoa without calling osascript in Unix, but here is a link to some Cocoa code that does call osascript to execute AppleScript code. It's not done, but it is a good start:
The above link is in a "gist" on github.com, so if you improve it, by adding more error-handling, I would appreciate if if you would check your improvements back into the gist.
What I'm doing now is just using the OSAScript from the OSAKit in Objective-C, for my model, and using my own controller and using NSTextView for the view.
It isn't too bad this way. It works fairly well with only a little bit of code, but I need to figure out how to hook things into the Document class so that the whole thing works together. Things like the syntax-coloring are a feature of OSAScript, it will give you rich text back to put into the view, so that works.
-- Kaydell |