-2
如何獲取NSAppleScript的返回值。 我正在使用蘋果腳本在iTunes中獲取歌曲標題並獲取該值並設置NSMenuItem的標題。NSAppleScript返回值
我的代碼:.M
//run applescript
NSAppleScript *script = [[NSAppleScript alloc] initWithSource:@"tell application \"iTunes\" to set song to name of current track"];
[script executeAndReturnError:nil];
//set menu item title
[songName setTitle:script];
我的代碼:.H
IBOutlet NSMenuItem *songName;
。這不是一個完整的問題,當你運行代碼時會發生什麼?你試過什麼嗎? – Dustin 2012-07-13 16:30:42
@DustinRowland當我運行代碼_is_我嘗試過的代碼時沒有任何反應。 – atomikpanda 2012-07-13 18:32:31