Can I use the application as a library (Mac, Objective-c)?

Is there a way to download classes from a mac application and use them in another Mac application?

I would like to make an Automator action that accesses some classes in my mac application, and this is similar to how I ideally do it (which means you have to buy my application to use the Automator action, etc.)

+3
source share
5 answers

Depending on what you want to do (I'm not quite clear), Service may do the trick for you. You create an auxiliary application that can transfer data back and forth with your application using a common cardboard. You can get a fairly wide range of actions because you can pass any object that matches NSPasteboardWriting and NSPasteboardReading ; as stated in the documents NSString, NSAttributedString, NSURL, NSColor, NSSoundand NSImageis already available to you, and, of course, you can write your own class that meets your needs exactly.

+4
source

Automator Automator?

, Automator , , ( , ).

3 Automator: AppleScript, shell- script Objective-C. , Objective-C, Objective-C (. Objective-C ). ( , , , AMAppleScriptAction).

, Objective-C AppleScript, .

, KWDocument, -duplicateObjects:(NSArray *)objects toDocument:(KWDocument *)destDocument;. KWRegistrationManager, , . , , " ". KWDuplicateObjectsToDocument, AMBundleAction. Info.plist Duplicate Objects to Document.action NSPrincipalClass KWDuplicateObjectsToDocument.

KWDuplicateObjectsToDocument.h :

#import <Cocoa/Cocoa.h>
#import <Automator/AMBundleAction.h>

@interface KWDuplicateObjectsToDocument : AMBundleAction {

}

- (id)runWithInput:(id)input fromAction:(AMAction *)anAction
                                  error:(NSDictionary **)errorInfo;

@end

KWDuplicateObjectsToDocument.m :

#import "KWDuplicateObjectsToDocument.h"
#import "KWDocument.h"
#import "KWRegistrationManager.h"


@implementation KWDuplicateObjectsToDocument

- (id)runWithInput:(id)input fromAction:(AMAction *)anAction
          error:(NSDictionary **)errorInfo {
      if (![[KWRegistrationManager defaultManager] isRegistered]) {
          return nil;
      }

    // eventually you'll call 
    // duplicateObjects:toDocument:

      return input;
}

@end

, , (, KWRegistrationManager, KWDocument ..), .

+3

Applescript, , . , , . OS X ( UNIX- ). . . , ​​, .

, , , , .

EDIT:

NSGod , , Applescript Obj-C. .

+2

. , Automator. Automator, , . , .

, , , , , , .

+2

Basically, no: you cannot reference an executable file.

The application binary file is in a specific format. And this format is different from the format of a static or shared library.

This means that you cannot download any parts of the code from a binary application, as it would with a library.

+2
source

All Articles