1
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init] ;
NSAppleEventDescriptor *eventDescriptor;
NSAppleScript *script ;
NSString* source ;
NSDictionary* errorDic ;
[email protected]"tell application \"iTunes\" \n"
@"set tname to name of track 1 of playlist 1 \n"
@"set tartist to artist of track 1 of playlist 1 \n"
@"set talbum to album of track 1 of playlist 1 \n"
@"set ttime to time of track 1 of playlist 1 \n"
@"set tbitrate to bit rate of track 1 of playlist 1 \n"
@"set tsize to size of track 1 of playlist 1 \n"
@"set trating to rating of track 1 of playlist 1 \n"
@"end tell";
script = [[NSAppleScript alloc] initWithSource:source];
eventDescriptor = [script executeAndReturnError:&errorDic];
NSString* frontUrl = [eventDescriptor stringValue];
NSLog(frontUrl);
/*NSAlert *alert = [[NSAlert alloc]init];
[alert setMessageText:frontUrl];
[alert runModal];
[alert release];*/
[pool release] ;
NSlog는 트랙 등급 만 표시합니다. tname, tartist, talbum 등의 가치를 얻는 방법? '코코아에서 applescript의 변수 값을 얻는 방법은 무엇입니까?
내가 1 \t 말할 mydata을 끝을 얻을 재생 목록의 트랙 1의 {영구적 인 ID, 이름, 아티스트, 앨범}를 얻을 수 TELL 응용 프로그램의 "iTunes" \t 설정 mydata을 변경하려고 하지만, 결과는 null – Irwan
'{tname, tartist, talbum, ttime, tbitrate, tsize, trating}'만 반환하면됩니다. 일단 작동하면 목록 대신 레코드를 반환하고 처리하여 AppleScript 코드와 Cocoa 코드간에 동의하는 인덱스에 의존하지 않도록 할 수 있습니다. –
감사합니다 피터! 효과가있다. – Irwan