且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将字符串从 Applescript 传递到 Objective C

更新时间:2023-02-12 15:53:30

快速示例:

NSString *theScript =   @"set theTimeString to time string of (current date)\n"
                         "return theTimeString";

NSDictionary *errorInfo = nil;
NSAppleScript *run = [[NSAppleScript alloc] initWithSource:theScript];
NSAppleEventDescriptor *theDescriptor = [run executeAndReturnError:&errorInfo];
NSString *theResult = [theDescriptor stringValue];
NSLog(@"%@",theResult);

输出:

下午 2:36:06