Solved

AppleScript Repeat Not Working

Posted on 2013-01-31
3
535 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Is your phone running out of space to hold pictures?  This article will show you quick tips on how to solve this problem.
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…

630 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