Solved

AppleScript Repeat Not Working

Posted on 2013-01-31
3
512 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
  • 2
3 Comments
 
LVL 19

Assisted Solution

by:Kash
Kash earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
repeats do work you just have to specify the variable after the repeats have reached the end of the data.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Yesterday Apple introduced their revolutionary new iOS 5 operating system that claims to be the ultimate mobile technology interface. One of the biggest innovations of the new operating system is the introduction of the iCloud computing network. Thi…
In this article we have discussed about the OS X EI Capitan and how to fix Wi-Fi issue in OS X El Capitan. We have explained how to delete system level preferences and create a new Wi-Fi location to resolve Wi-Fi issue.
Users will learn how resize a batch of photos from a single command in Photoshop via Photoshop's Image Processor. Open up an Image you'd like to resize in Adobe Photoshop: Adjust the image size according to your preferences. Image > Adjustments > …
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now