Skip to content

Instantly share code, notes, and snippets.

@vojto vojto/gist:3954249
Created Oct 25, 2012

What would you like to do?
Cocoa script for getting definitions of words
int main(int argc, const char * argv[])
@autoreleasepool {
if (argc == 1) {
return 1;
NSString *word = [NSString stringWithCString:argv[1] encoding:NSUTF8StringEncoding];
CFStringRef result = DCSCopyTextDefinition(nil, (__bridge CFStringRef)word, CFRangeMake(0, word.length));
NSString *definition = (__bridge NSString *)result;
const char *cDefinition = [definition cStringUsingEncoding:NSUTF8StringEncoding];
printf("%s", cDefinition);
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.