开发者

Objective-C Scripting Bridge and iTunes

Hi i need a little help i want to include 2 buttons on my Mac App which will trigger 2 actions, 1 will trigger the iTunes shuffle feature and set it to YES but if it is all ready set to YES then it will开发者_开发百科 set it to NO. The other will get iTunes current playback repeat mode.

This is what i have found from the iTunes.h file and also here's a description of the iTunes.h file http://merbist.com/2010/01/17/controlling-itunes-with-macruby/

@property BOOL shuffle;  // play the songs in this playlist in random order?
@property iTunesERpt songRepeat;  // playback repeat mode

Can anyone help me, thanks Sami.


You need to declare an instance of SBApplication to talk to iTunes:

SBApplication *_iTunes = [[SBApplication applicationWithBundleIdentifier: @"com.apple.itunes"] retain];

Once you have this SBApplication (keep it around in your class), use it to control iTunes directly. For example, to turn on the "Shuffle" mode:

_iTunes.currentPlaylist.shuffle = YES;

will do the trick.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜