3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Benjamin Piwowarski
8 * Full author contact details are available in file CREDITS.
11 #import <Cocoa/Cocoa.h>
12 #include "AppleScript.h"
16 @interface LyxCommand : NSScriptCommand {
18 - (id)performDefaultImplementation;
21 @implementation LyxCommand
22 - (id)performDefaultImplementation {
23 // Get the command and argument
24 NSDictionary * theArguments = [self evaluatedArguments];
26 NSString * directParameter = [self directParameter];
27 NSString *arg = [theArguments objectForKey: @"arg"];
30 // Execute the command
31 LyXFunctionResult result = applescript_execute_command([directParameter UTF8String], [arg UTF8String]);
33 // Construct the result record
34 NSString *message = [NSString stringWithCString:result.message encoding:NSUTF8StringEncoding];
37 NSDictionary *objcResult = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt:result.code], @"code", message, @"message", nil];
43 /// Needed by AppleScript in order to discover LyxCommand
44 void setupApplescript() {