public
Description: A small sample application that defines a category of NSAppleEventDescriptor that will convert NSAppleEventDescriptors into normal Cocoa objects.
Homepage: http://www.fromconcentratesoftware.com/
Clone URL: git://github.com/Grayson/applescripttodictionarywithnutoo.git
Grayson Hansard (author)
Mon Apr 21 16:20:23 -0700 2008
applescripttodictionarywithnutoo / NSApplication+Applescript.m
100644 26 lines (20 sloc) 0.675 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//
// NSApplication+Applescript.m
// ApplescriptToDictionaryWithNuToo
//
// Created by Grayson Hansard on 4/21/08.
// Copyright 2008 From Concentrate Software. All rights reserved.
//
 
#import "NSApplication+Applescript.h"
 
 
@implementation NSApplication (Applescript)
 
- (id)ASPerformNu:(NSScriptCommand *)aScriptCommand
{
NSString *nuString = [aScriptCommand directParameter];
NSDictionary *context = [[[aScriptCommand evaluatedArguments] objectForKey:@"context"] toObject];
id nu = [Nu parser];
for (NSString *key in [context allKeys]) [nu setValue:[context objectForKey:key] forKey:key];
id ret = [nu eval:[nu parse:nuString]];
[nu close];
return ret;
}
 
@end