Solved

AppleScript Repeat Not Working

Posted on 2013-01-31
3
523 Views
Last Modified: 2013-02-06
Hi I am trying to write a script to read the library of iTunes and print out a list of the titles that comply with the conditions.  This is part of a tutorial I am going through.

tell application "iTunes"
      set the_No_Beatles_List to every track of library playlist 1 whose duration is greater than 3600 and duration is less than 5000 and artist does not contain "Beatles"
      set itunes_Records_No_Beatles to {}
      repeat with a_Track in the_No_Beatles_List
            set end of itunes_Records_No_Beatles to {TrackName:a_Track's name, TrackArtist:a_Track's artist, TrackAlbum:a_Track's album, TrackRating:((a_Track's rating) / 20)}
      end repeat
      
end tell

I know there is more than one list because the first track that comes up starts with the name Rick if I put that in the place of the name Beatles I get the next track which is Andrew.  So for some reason it isn't looping through the library.  Please help me to know what is wrong.  I am on Mountain Lion 10.8.

Thanks,

Randal
0
Comment
Question by:sharingsunshine
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 19

Assisted Solution

by:Kash
Kash earned 500 total points
ID: 38844067
i think you need to use LOOPS to repeat the search on the whole library >>> http://www.mactech.com/articles/mactech/Vol.20/20.12/RepeatLoops/index.html
0
 

Accepted Solution

by:
sharingsunshine earned 0 total points
ID: 38844156
Thanks for getting back to me but repeats will work.  I took the code above and after the repeat put in the name of the variable

itunes_Records_No_Beatles

then it showed all of the records that met the criteria.  But the site you gave me will help with some other issues so that's worth the points to me.  Incidentally, I googled extensively trying to find how to create a form in Applescrilpt and mactech never came up.  So I wouldn't have known about it if you hadn't mentioned it.
0
 

Author Closing Comment

by:sharingsunshine
ID: 38858701
repeats do work you just have to specify the variable after the repeats have reached the end of the data.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
teamviewer how can we hear remote system audio? 1 69
Sluggish MBP browser 17 94
Grant administer privileges to another admin user 9 99
Understanding UserAgent String 2 45
We could spend the next millennium discussing the differences of the Mac and Windows platforms. The next century will continue to have fanatics on both side of the equation and neither side will win the war. However, that’s not why we are here. W…
A lot of new and distinct gadgets are making their appearance every other day. The latest gadget that has wooed the attention of all gadget lovers and non gadget lovers alike is the Smartwatch. This tiny gadget is capable of offering live access to …
Users will learn how to set proper sequence settings, scale images, paste attributes, add transitions, fades, and music. Open up Final Cut Pro 7 and Create a new Project: Set the Sequence Settings. a) Click File > Easy Setup > Format > Apple ProRe…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question