Search code examples
macositunes

Where can I get the guidance or template about iTunes?


I want to develop an application, not an extension. But the application has the right to control iTunes and get information of music, such as Lyrics from iTunes (Similar to SuperTunes). Where can I get relevant template or guidance? Thanks.


Solution

  • As for the control of iTunes, There is no native cocoa API, however you can use AppleScript, that can be ran from the app using:

    NSString* path = [[NSBundle mainBundle] pathForResource:@"ScriptName" ofType:@"scpt"];
    NSURL* url = [NSURL fileURLWithPath:path];NSDictionary* errors = [NSDictionary dictionary];
    NSAppleScript* appleScript = [[NSAppleScript alloc] initWithContentsOfURL:url error:&errors];
    [appleScript executeAndReturnError:nil];
    

    A good example of the AppleScript commands that can be used, can be found here: http://dougscripts.com/itunes/itinfo/info03.php