ITunes info into Applescript

I'm just starting with applescript, and i'm trying to create a list or an array with all info from my itunes library. I'd ideally like to form an array such as [trackName, trackArtist, trackGenre, playCount]
So far I have:
tell application "iTunes"
          set musicArray to the {name, artist, genre, played count} of every track of playlist "Music"
end tell
But this seems to create a list in the form {{name0, name1} {artist0, artist1} {genre0, genre1} {pc0, pc1}}
how can I group the elements such that they are stored {{ name0, artist0, genre0, pc0}{name1, artist1, genre1, pc1}}
Or, how can I reference or call an index in the array similar to
show played count of musicArray[index 0]
Thanks

For your first question, to group the properties of each item of the playlist you can step through the items, adding the desired properties to a list - for example:
set musicArray to {}
tell application "iTunes"
  repeat with anItem in every track of playlist "Music"
  set end of musicArray to {name, artist, genre, played count} of anItem
  end repeat
end tell
set X to 2 -- the index
return fourth item of musicArray's item X -- played count
For your second question, it might read better to create a record, using the names of the properties - for example:
tell application "iTunes"
  set musicRecord to the {|name|:name, |artist|:artist, |genre|:genre, |played count|:played count} of every track of playlist "Music"
end tell
set X to 2 -- the index
return item X of musicRecord's |played count|
Note that I've enclosed the record property names in pipes, since they are iTunes terms (and the space in "played count" can't be used in a variable name otherwise).  This also allows them to be used as regular variables outside of an iTunes tell statement.

Similar Messages

  • How to Transfer iTunes Info into ID3?

    Hi all,
    I Have my itunes Library sorted to my liking, but I want all the information (Artist, Genre, Year, Album Art etc) to be transfered to the Mp3's ID3 Tag so all the info is portable. Does anyone know how to use this? I'm using 10.5.3 OS X w/ the latest version of itunes, thanks again!

    I Jut found that it copied my library into another folder and all of those are tagged! (Though the originals I have Placed in the Library remain unchanged? Also, In that new folder it made with copies w/ ID3 tag, sometimes there are two of each in a folder, does anyone know why? Ie.
    Artist - Song
    Artist - Song 1
    Anyone know why this is happening? Thanks for the quick reply!
    EDIT:
    Sorry for the confusion, but here's my overall problem. I have all my music sorted in a folder as I like it, though I didn't know an option was on to copy my music over to another folder. What I would like ultimately is to get rid of all the music that it created, and have it use the original files as the m=path to the MP3's, though I would like to transfer all the ID3 Tags (Genre, Artist, Albumart, etc) that I have currently set. Is this possible? Or do I have to clear the library and individually add them back album-by-album with the copy-to-another-folder option off? Thanks again!
    Message was edited by: Jadestone

  • Itunes info into Windows Explorer

    Before I recently updated iTunes whenever I would enter detailed information about a song in the iTunes information tab if I had Windows Explorer open that same information would appear in the proper columns on the same MP3 file line in Windows Explorer. After I installed the latest version of iTunes that no longer happens. I didn't change any settings in iTunes that I am aware of.
    I found this very convenient to maintain only updated information on my songs. Anyone have any suggestions on what I might have changed or how I can get this function to happen again.
    My thanks to anyone who can assist.

    This can sometimes happen with files that have multiple tags. iTunes shows and updates one version while Windows Explorer shows another. In some cases iTunes can even update one tag and then reread unchanged data from another. I suspect nothing has changed but you've run into a problem album at the same time as the update. Check with a file you know has changed in the past.
    One way to clean up the tags is to select some tracks and use the right-click option Convert ID3 Tags > None a few times, then use Convert ID3 Tags > v2.3. iTunes will retain and then replace all of the information it has with the exception of embedded artwork which will be removed.
    tt2

  • I am getting an error message when I try to sign into icloud with my itunes info.

    I am trying to sign into the icloud on my PC since I do not have an iphone or ipad.  When I enter in my itunes info it says - "This Apple ID is valid but is not an icloud account" . Why can't I sign in using my itunes info?

    Ok, back now.  Have her follow the instructions under "Share a calendar publicly" here: http://help.apple.com/icloud/#/mm6b1a9479.  (Note: the term "publicly" is a bit of a misnomer.  It won't share the calendar with the public at large, it will only give her a url link that she can share with people such as yourself who don't have an iCloud account to allow them to subscribe to her calendar with read-only access.)

  • HT201209 I entered my card info into iTunes but didnt make a purchase at that . iTunes shows mt 25 dollars but wants the code again. I no longer have c I thought once I registered it my acct was credited.

    III entered my card info into iTunes but didnt make a purchase at that . iTunes shows mt 25 dollars but wants the code again. I no longer have c I thought once I registered it my acct was credited.

    I am confused. Are you talking about a credit card?

  • How do I merge two valid, purchased iTunes accounts into one so all my music is in same account?

    I have two valid, purchasd iTunes accounts.  Older iPod has some great music, I just got a new iPad and set up second iTunes account, bought some more iTunes items for that account.  Just discovered iCloud.  Now I want to put all my music from both accounts onto the cloud so I can access it on all my apple devices.   Can't seem to add from one account to the other.  Can sign onto the new account wiht my old iPod, but it will not let me sync without erasing all the music on the device.  How can I merge these two accounts into one?
    PS  Makes you wonder how helpful support is when the usernames "Frustrated," "really frustrated," and "Help!!!!" are all taken...lol

    HeyStupid wrote:
    how do I merge two valid, purchased iTunes accounts into one so all my music is in same account?
    You cannot. iTunes pruchases remian tied to the account they were purchased with.
    I just got a new iPad and set up second iTunes account,
    Why?
    Remove your info from new account, update old account as needed and use that.

  • Changing from PC to Mac & want to retain my iTunes info

    Hey folks: I'm eager to switch from my PC to a Mac, but I can't figure out how to get my iTunes info from my PC into my Mac. I can access my music files, since they're on an external hard drive, and I've been able to successfully import the library, but it doesn't bring over all my information like rating, play history, date added etc. Any advice? Please contact me directly at [email protected] Thanks much, Matt.

    Here's one person's method:
    http://www.brooks-bilson.com/blogs/rob/index.cfm?mode=entry&entry=6AE0A0A7-BD95- 8DAB-DE16B46EB48026A9

  • Can I sync Address Book and iCal to put contact info into iCal?

    I use Address Book as a contact/customer list and use iCal to prepare my schedule for work. I usually type in the name of the customer I want to see in iCal. Is there anyway to import or drag names out of Address Book into iCal so the location & contact info will be included? I don't want to invite the customer. I just want to input the info into iCal so I don't have retype a name that is already in my Address Book.
    If I have customer "xxx" in Adress Book and I am planning on visiting this customer tomorrow. Is there anyway for me to transfer/import this info to iCal without physically typing "xxx"? When I look at my appointment I would love to see the contact info for "xxx" in iCal when I click on individual appointments.
    I hope this makes sense.

    Hi,
    You can link to the Address Book entry with a URL. See my script +Link to Address Book+ on this page http://www.nhoj.co.uk/applescripts/ which creates a link from the currently selected person in Address Book. These can then be added to the URL field in iCal or the notes field if you have more than one per event.
    Best wishes
    John M
    <hr />As I sell software on my site and ask for donations, the Apple Discussions Use Agreement requires that I state that I may receive some form of compensation, financial or otherwise, from my recommendation or link.

  • Checking/unchecking a box in "get info" with Applescript

    I've never used Applescript or automator but I think one of them could help me. I need to run Photoshop CS3 normally most of the time but when I have to scan I have to run it in Rosetta. To do this I get the "get info" box up for CS3 and check or uncheck the "open using rosetta" checkbox. The problem is I have to plough throgh several folders to get to the CS3 application and I was hoping I could get applescript or automator to do this with one click. Can anyone tell me what I would have to type into Applescript or how I would automate this?
    Thanks for any help.
    Mark

    Replace ...
    HD1_160:Applications:Safari.app
    ... (the path to 'Safari', on this Macintosh) in ...
    tell application "Finder" to set current panel of (open information window of file ("HD1_160:Applications:Safari.app")) to General Information panel
    ... with the full path to CS3.
    You can save the code (via 'Script Editor's 'File, Save' menu item) ...
    01. As an 'Application' (via the 'File Format:' popup menu).
    02. As a script (in the current users '$HOME/Library/Scripts/' folder; or, elsewhere, with an alias of it - in the '$HOME/Library/Scripts/' folder); and, access it (the script) via the 'Script Menu' (which is added to the menu bar via 'AppleScript Utility.app' in the '/Applications/AppleScript/' folder).

  • HT204088 So I put in my debit card info into my phone so I could redownload apps and while I was refreshing netflix (which was already purchased) it rebought itself twice and took $14 (USD). What can I do?

    So I put in my debit card info into my phone so I could redownload apps and while I was refreshing netflix (which was already purchased) it rebought itself twice and took $14 (USD). What can I do? Someone please help!

    Contact iTunes Support: http://apple.com/emea/support/itunes/contact.html.

  • Entering info into "category"

    Anyone know how to enter info into the "category" heading for an iTunes selection? When I "get info" for an iTunes selection, I do not see the "Category" heading that is offerd in "view options".
    Many thanks.

    Richard,
    I'm so glad you posted this question. I just discovered the mysterious "category" field today. The following post discusses it a bit, but I'm hoping to find out more.
    Bensch, "How do I use the new fields "category" or "description"?", 06:10pm Sep 7, 2005 CDT

  • HT4480 I put my itunes dollars into itunes and am trying to use it to buy lion on my PC and I cant get it to work.  I guess I did it wrong, is there a way to get this money to use for the lion app?

    Hi, I put my itunes dollars into itunes thinking I could use it to buy the Lion App and when I went to down load it asked for the money then.  Is there a way to take the money from my itunes account?

    Hi..
    "put my itunes dollars" ...  did you redeem an iTunes gift card? I see you used the link about redeming a code.
    Three ways to purchase Lion
    One if from redeeming an iTunes gift card. Two, setting up a credit or debit card account with iTunes associated with your Apple ID, or purchase the thumb drive > OS X Lion USB Thumb Drive - Apple Store (U.S.)
    If you redeemed an iTunes gift card, make sure there is enough funds available. You need to take into account when you purchase apps including Lion, there may be applicable taxes or fees added the original purchase price.
    Info regarding taxes and fees:  iTUNES STORE - MAC APP STORE - TERMS AND CONDITIONS

  • My iTunes downloads were made using my old gmail address.  I had to quit using this email address as it got hacked.  I created a new gmail account.  How can I get my iTunes downloads into the new gmail account?

    My iTunes downloads were made using my old gmail address.  I had to quit using this address  as it got hacked.  How do I get my iTunes downloads into my new iTunes account that was created with a new gmail address?  In my old iTunes account (with the old gmail address,  I can't 'update' my email address or even 'add an alternate address' as I had already created this gmail account and inputting the new address into iTunes gives me the 'pop-up' that 'this account is already in use.'   Advice please!

    Good luck. It took me weeks to fix this when I had to do it. Your old ID branches out in lots of places. You may have to delete app and get them again, at least that is what Apple told me. Plus, all of your settings on your iPad that required any ID, will have to be changed. My old ID kept showing up in different places for weeks. Changing it on Apple.com is just the beginning.

  • How can I change an American Itunes Card into a UK one?

    So I found this cool version of Genroku Hanami Odori by a group called Waraku Ensemble, but it's only avalible in the UK stores and I live in the US. How can I convert an American Itunes card into a UK card?

    I was asking if there was a way to convert an American Card into a UK card
    Trade with sombody who has the opposite issue.

  • HT1473 can i use more than one ipod on my itunes account?  How do I get the music from one itune account into another on one computer?

    My husband and I would like to combine our itunes libraries into one for each of our ipods.  Can this be done?

    You can just copy all of your music to an external sourcce ( cd/dvd/flash drive/hard drive) then copy onto the other computer.
    You can type "merge itunes library" into the google search bar.

Maybe you are looking for