Applescript, iTunes and control

Discussion in 'Mac Programming' started by Sdashiki, Feb 20, 2006.

  1. macrumors 68040


    is it possible to get iTunes info into another application, and use that application to also control iTunes?

    basically a front end for iTunes, that lists all the stuff and has all the functionality of iTunes itslef, but in a different layout.

    Can you get the info from iTunes in real time and control it as well?

    Looking to try to make a Front End for a touchscreen kind of interface....just new to coding and wanted to know if its possible, then look more into it.

  2. Moderator


    Staff Member

  3. macrumors 68040


    those are scripts to run inside of iTunes.

    What I want is a script that can control iTunes from another app.
  4. Moderator


    Staff Member

    No they are not. These scripts can be saved as stand alone "apps" from Script Editor. To control iTunes from another app you will have to send these commands to it via AppleScript/Apple Events.

    The whole Tell application "iTunes" is a bit of a giveaway that they run from outside iTunes.

    You could use the scripts as the basis for a simple AppleScript Studio app to control iTunes.

    If you are using Cocoa then look at the NSAppleScript class to send the Applescript commands.
  5. macrumors 68040



    what about getting iTunes information to disply?

    Like track times, playlists, etc etc.

    I am looking to make a touchscreen interface for iTunes.
  6. Moderator


    Staff Member

    You can query this via AppleScript, but, speeking from experience, it's really slow. I'd use AppleScript for the control and to get the details of the current track (i.e. how long it's been playing) and parse the xml library file for the rest. Apple only creates this file for this purpose, it's not used for anything else. It takes some code I have lying around about 30 minutes to get all the track details from my 7000 song library via AppleScript! You could parse the xml in seconds...
  7. macrumors 68040


    Ill look into it more, thanks alot.
  8. macrumors G4


    You might want to take a look at what Quicksilver is doing with triggers - and playlists etc through its normal interface.

    You can set up triggers to control iTunes from anywhere so Command, Ctrl Space can be Play/Pause regardless of where you are.

Share This Page