Adding AScript to a Cocoa app

So I have a pure Cocoa app, and need to add Applescript functionality to a button. (At this point it’s really just a test app to check for functionality.) I’ll be looking into AscriptObjC soon, but not for this app.

I added the ApplescriptKit.Framework into the frameworks folder, added the AS compile build steps.

My question is, in the main.m file, what is needed, truly?

Here’s the main.m for an Applescript app:

extern void ASKInitialize();
extern int NSApplicationMain(int argc, const char *argv[]);

int main(int argc, const char *argv[])
    return NSApplicationMain(argc, argv);

and here’s the main.m for a cocoa file:

#import <Cocoa/Cocoa.h>

int main(int argc, char *argv[])
    return NSApplicationMain(argc,  (const char **) argv);

If I remove the 2 lines referencing ASK from the Applescript (test) app, it seems to work OK. If I add them to the cocoa app, it works OK with or without them. So, are they necessary at all?

You only need the ASK stuff if you’re going to use something from AppleScriptStudio.

Hi Shane,
So what exactly does that mean? I figured A.Studio was integrated into XCode-- that it was the ability to name buttons and attach scripts to them in IB, and to edit scripts in XCode. How can that be “disconnected” from the rest of the IDE? or, How is it possible to use Applescript at all, without using A.Studio?