Applescript, iTunes and control

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

  1. Sdashiki
    Expand Collapse
    macrumors 68040

    Sdashiki

    Joined:
    Aug 11, 2005
    Location:
    Behind the lens
    #1
    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.

    thanks
     
  2. robbieduncan
    Expand Collapse
    Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
  3. Sdashiki
    Expand Collapse
    thread starter macrumors 68040

    Sdashiki

    Joined:
    Aug 11, 2005
    Location:
    Behind the lens
    #3
    those are scripts to run inside of iTunes.

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

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    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. Sdashiki
    Expand Collapse
    thread starter macrumors 68040

    Sdashiki

    Joined:
    Aug 11, 2005
    Location:
    Behind the lens
    #5
    thanks.

    what about getting iTunes information to disply?

    Like track times, playlists, etc etc.

    I am looking to make a touchscreen interface for iTunes.
     
  6. robbieduncan
    Expand Collapse
    Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #6
    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. Sdashiki
    Expand Collapse
    thread starter macrumors 68040

    Sdashiki

    Joined:
    Aug 11, 2005
    Location:
    Behind the lens
  8. Applespider
    Expand Collapse
    macrumors G4

    Applespider

    Joined:
    Jan 20, 2004
    Location:
    looking through rose-tinted spectacles...
    #8
    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