Qanday qilib men appletscriptdan Objective Cga bir satrni o'tkaza olaman?

Belgilash dan Objective C ga string o'zgaruvchisini yuborish bo'lishi kerak bo'lgan dastur ustida ishlayapman. Objective C classda Applescript dasturidan qanday ishlashni bilib oldim, ammo Nsstringni Applescript dan ga o'rnatish uchun kerak. . Buni qanday amalga oshirishim mumkin?

Oldindan rahmat!

3

2 javoblar

Tez misol:

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);

Chiqish:

2:36:06 AM

7
qo'shib qo'ydi
Bu men uchun qidirmoqdaman, rahmat.
qo'shib qo'ydi muallif Fernando Cervantes, manba

Have a look at the documentation for NSAppleEventDescriptor, especially the method -[NSAppleEventDescriptor stringValue]

1
qo'shib qo'ydi