Error in script to set album rating in iTunes

Hi
I used to use the following script to set album ratings of albums in my iTunes library.  It used to work fine, but now it's not working.  When I try to debug it I am getting the following error:
"Scripting component error."
on this line in the third block:
repeat with R in (rating of tracks whose album is thisAlbum)
I wonder if anyone can spot what the problem might be?
Thanks,
Nick
  --Make a list of all the selected albums:
          set theAlbums to {}
          set theAlbumsRef to a reference to theAlbums
          set tempList to album of selection
          set thePreviousTitle to ""
          repeat with thisTitle in tempList
                    set thisTitle to thisTitle as text
                    if thisTitle is not thePreviousTitle then
                              copy thisTitle to the end of theAlbumsRef
                              set thePreviousTitle to thisTitle
                    end if
          end repeat
          set numberOfAlbums to count theAlbums
  --Make a list containing one track for each selected album:
          set theTracks to {}
          set theTracksRef to a reference to theTracks
          repeat with thisAlbum in theAlbums
                    copy (track 1 whose album is thisAlbum) to the end of theTracksRef
          end repeat
  --Set the album rating of each album contained in the selection:
          set theRatings to ""
          set k to 0
          repeat with thisTrack in theTracks
                    set k to k + 1
                    if k mod 25 = 0 then beep 1 -- for audio feedback
                    set thisAlbum to item k of theAlbums
                    set numberOfTracks to 0
                    repeat with k from 1 to (disc count of thisTrack)
                              try
                                        get (track count of track 1 whose (album is thisAlbum) and (disc number is k))
                                        set numberOfTracks to numberOfTracks + result
                              end try
                    end repeat
                    set songRating to 0
                    repeat with R in (rating of tracks whose album is thisAlbum)
                              if R > 80 then set R to 80
                              set songRating to songRating + R
                    end repeat
                    set thisRating to round (songRating / numberOfTracks)
                    set album rating of thisTrack to thisRating
                    set theRatings to theRatings & (album artist of thisTrack & tab & thisAlbum & tab & (thisRating as text) & return)
          end repeat
          display dialog "The album “" & thisAlbum & "” has a rating of " & thisRating with icon 1 buttons {"OK"} default button 1
end tell

problems like this are usually solvable by splitting up the line.  It doesn't look like it, but there's a whole lot going on in that compound statement. try:
tell application "iTunes"
          set ratingList to (rating of tracks whose album is thisAlbum)
          repeat with R in ratingList
                    if R > 80 then set R to 80
                    set songRating to songRating + R
          end repeat
end tell

Similar Messages

  • When opening iTunes, I get the following error message: the registry setting used by the iTunes drivers for importing an burning CDs and DVDs are missing.  This can happen as a result of installing other CD burning software.  Please reinstall iTunes.

    When opening iTunes, I get the following error message: "The registry setting used by the iTunes drivers for importing an burning CDs and DVDs are missing.  This can happen as a result of installing other CD burning software.  Please reinstall iTunes."
    I have reinstalled iTunes twice and still get the message.
    Any clues??
    Thank you.

    I'd start with the following document, with one modification. At step 12 after typing GEARAspiWDM press the Enter/Return key once prior to clicking OK. (Pressing Return adds a carriage return in the field and is important.)
    iTunes for Windows: "Registry settings" warning when opening iTunes

  • Issues with setting "Album Artist" in iTunes 9.2.5.1 on Windows 7

    I googled this for a while but haven't been able to find this issues mentioned anywhere else yet. Here's what's happening: I am importing CDs to iTunes 9.2.1.5 on Windows 7 Pro (64 Bit) using MP3 Encoder > Higher Quality. All is well except for a few CDs where I'd like to set an overall Album Artist. Example: Tony Bennett's Duets: An American Classic. When importing the CD it shows up under "Various Artists" since "Artist" is always Tony Bennett plus whoever he sings with. To make sure the album shows up under Tony Bennett in the library I click on the album and set "Album Artist" to Tony Bennett. That, however results in changing the "Artist" field as well now so all fields say Tony Bennett, which shouldn't happen, "artists" should stay unchanged. I tried this with several albums and the behavior is always the same.
    I also tried the back door by going into the actual folder of the album in Windows then change the MP3 details and populate "Album Artist" there for all tracks within the album. Once I re=open iTunes it registers the change only for the first track but not the rest. So I re-import the folder into iTunes and then it does take "Album Artist" and also leaves "Artist" unchanged but for some reason has now lots of numbers under "Comments". There seems to be a mismatch of the field attributes between iTunes and Windows for MP3 files (possibly other formats as well). Wondering if anyone else has observed this or if I am just missing some setting.

    FYI iTunes handling of ID3v2.4 tags seems to have some issues as well... Translating genres into their numeric codes for one thing. I'd recommend sticking with v2.3.
    I'm not exactly sure from your posts what you were seeing. Was the artist being changed in Get Info. after you'd set Album Artist, or was it changing elsewhere on screeen? iTunes 9(.1 I think) added an option *View > Column Browser > Use Album Artists*. Unfortunately this doesn't change the heading of the column so that you "see" it is now only listing album artists but that's what it does.
    There is also an occasional issue with the current build in that sometimes changes to Album Artist or Sort Album Artist fail to be reflected properly in the column browser until iTunes is closed and reopened.
    tt2

  • Error when attempting to download  album artwork in iTunes 8

    nevermind, wrong category...
    Message was edited by: Barbara_Eden

    Yes, I get it also. I have powered down, restarted, reopened iTunes and it still doesn't work (to download ArtWork). Everything else seems to work fine, and the rt Work download used to work fine as well ... not now

  • I keep getting the following error message when I try to update my itunes, "There is a problem with this windows installer package. Aprogram run as part of the set up did not finish as expected.  Contact your support personnel or package vendor."

    I keep getting the following error message when I try to update my itunes, "There is a problem with this windows installer package. Aprogram run as part of the set up did not finish as expected.  Contact your support personnel or package vendor."

    Yes, I had found a similar solution also.  I'm running XP Pro, SP3.  I went Control Panels/ Add-Remove programmes/apple software update/ change/ repair.  Then run the 10.5 exe.
    While the programme updated from version 8 of iTunes, my new iTunes is now a mess.  Not all of my music was in the same folder previously but it all showed up on iTunes.  Now many albums have been left out, some have only a few tracks and some have two copies of some tracks as well as having other tracks missing.  I haven't begun to work on that.

  • Can't remove album rating from an album

    For some reason I can't remove the album rating from one of my albums in iTunes 7.6. I can change the rating, but if I swipe the cursor all the way to the left (which removes all stars on other albums) I get weird, hollow stars that then revert to a four-star rating when I play a file.

    That was it. One song had a rating (probably dues to a random mouse error lol - I usually don't rate songs).
    Thanks.

  • Scripting & Applying Set Percentage in Javascript

    I need to script a set percentage to an existing calculated total field in order to show a new field total with the set percentage applied. Total is already calculated in the form, but I'm not sure how to plug in the 2.25% to calculate for a final total.
    Example:
    Total ____
    Final Total ____ (new field with 2.25 percentage applied)

    Robert,
    Great – thanks! I did figure that out (eventually), but now have the issue of the Permit Fee field showing $0.26 when it should just show $0.00 until the Number field is filled in and the amount is calculated. Can you help? The error screen says that it doesn’t like the last equal sign. I’m at a loss…
    TopmostSubform.Page1.Cell[10].Permit_Fee::calculate - (FormCalc, client)
    Permit_Fee.rawValue = (4000.00Cell[8].Number + 0.25)1.0225
    If(Number.isNull | Permit_Fee = “”)
    Thanks!
    Noemi Harvell

  • Fatal error in script

    I am getting a fatal error at script line 1087 "unable to open destination
    file" when trying to install my cvi project under win98. It works fine under
    NT. What should I do?

    "Rick Bernstein" wrote:
    >>I am getting a fatal error at script line 1087 "unable to open destination>file"
    when trying to install my cvi project under win98. It works fine under>NT.
    What should I do?
    Hi Rick,
    One thing that you can check up for , is to make sure that you have a Temp
    directory on your machine, where you are installing the program.
    You may also want to set a Temp environment variable in autoexec.bat before
    you
    try to install anything..
    Hope this info help....
    Regards,
    nandan dharwadker
    Nandan Dharwadker
    Staff Software Engineer
    Measurement Studio Hardware Team

  • Error during script logic processing from UJKT tcode

    Hi,
    When I try to execute the script logic through UJKT tcode, it gives me the following exception:
    UJK_EXECUTION_EXCEPTION:Runtime error Duplicate recordMember (D_AUTO_UAE) of dimension (DIVISION) is not a valid member.
    Following is the script logic:
    *RUN_PROGRAM VALIDATION
       CATEGORY = %CATEGORY_SET%
       GROUP= %GROUPS_SET%
       TID_RA = %TIME_SET%
    *ENDRUN_PROGRAM
    BAdi used is BADI_UJ_CUSTOM_LOGIC
    Also the error log displays entire set of data records, instead I will like to see only the status of whether it went successful or not.
    Where can I check this setting?
    Please help.
    Thanks and Regards,
    Pankaj

    Hi Pankaj,
    I would request you to re-process the DIVISION deimension (preferrably all the dimensions). Then re-process and optimize the application. See, if you are getting any errors or not.
    Hope this helps.

  • /usr/bin/bash[34]: syntax error at line 40 : `set' unexpected

    Hi All
    I would like to install Oracle Database 11gR1 On Solaris 10
    When I run root.sh command, I confused to input path
    *# cd /home/oracle11/app/oracle11/product/11.1.0/db_1*
    *# ./root.sh*
    Running Oracle 11g root.sh script...
    The following environment variables are set as:
    ORACLE_OWNER= oracle11
    ORACLE_HOME=  /usr2/home/oracle11/app/oracle11/product/11.1.0/db_1
    *Enter the full pathname of the local bin directory: [usr/local/bin]:/usr/bin/bash*
    I have inputed "/usr/bin/bash"
    Now I can not run bash on Solaris 10.
    *# bash*
    bash[34]: syntax error at line 40 : `set' unexpected
    Please help me!
    Thankyou and best regards,
    thiensu2810

    Hi
    Output of "$ find /usr -name bash 2>/dev/null" is
    *# find /usr -name bash 2>/dev/null*
    */usr/bin/bash*
    *# less /usr/bin/bash*
    +###################################+
    +#+
    +# $Header: coraenv.sh 17-may-2007.08:31:33 jboyce Exp $ coraenv+
    +#+
    +# Copyright (c) 1987, 2007, Oracle. All rights reserved.+
    +#+
    +# This routine is used to condition a C shell user's environment+
    +# for access to an ORACLE database. It should be installed in+
    +# the system local bin directory.+
    +#+
    +# The user will be prompted for the database SID, unless the variable+
    +# ORAENV_ASK is set to NO, in which case the current value of ORACLE_SID+
    +# is used.+
    +# An asterisk '*' can be used to refer to the NULL SID.+
    +#+
    +# 'dbhome' is called to locate ORACLE_HOME for the SID. If+
    +# ORACLE_HOME cannot be located, the user will be prompted for it also.+
    +# The following environment variables are set:+
    +#+
    +# ORACLE_SID Oracle system identifier+
    +# ORACLE_HOME Top level directory of the Oracle system hierarchy+
    +# PATH Old ORACLE_HOME/bin removed, new one added+
    +# ORACLE_BASE Top level directory for storing data files and+
    +..................................+
    +.................................+
    else
    if (-e $ORABASE_EXEC) then
    if (-x $ORABASE_EXEC) then
    set BASEVAL=`$ORABASE_EXEC`
    setenv ORACLE_BASE $BASEVAL
    echo "The Oracle base for ORACLE_HOME=$ORACLE_HOME is $ORACLE_BASE"
    else
    echo "The $ORACLE_HOME/bin/orabase binary does not have execute privile
    ge"
    echo "for the current user, $USER.  Rerun the script after changing"
    echo "the permission of the mentioned executable."
    endif
    else
    setenv ORACLE_BASE $ORACLE_HOME
    echo "The Oracle base for ORACLE_HOME=$ORACLE_HOME is $ORACLE_BASE"
    endif
    endif
    +#+
    +# Install local modifications here+
    +#+
    thank,
    thiensu2810

  • Hollow stars.... itunes assigns an album average based on my star ratings, but in what scenario do Songs get assigned a hollow star? does itunes acquire info from other media programs or solely from what ive rated in itunes, orrr....

    Hollow stars.... itunes assigns an album average based on my star ratings, but in what scenario do Songs get assigned a hollow star? does itunes acquire info from other media programs or solely from what ive rated in itunes, or does itunes use other peoples ratings... Hollow Star assignment basis?

    If you assign songs a rating an unrated album gets an automatic rating, which you can override by rating it.
    If you assign an album a rating unrated songs get an automatic rating, which you can override by rating them.
    iTunes doesn't import ratings from tags, or third party services. You set them.
    You can't turn automatic ratings off.
    tt2

  • Error :Action Script Stuck

    Hi,
    I am getting the Error(Action Script Stuck), while i am
    running the application in Palm Treo 700 w 1.1 Verizon Emulator,
    its running in windows Mobile 5.0. I used one Datagrid, one Xml
    Connector, one Data Set and two buttons. And data are populated
    from the XML file, which has been located in the same folder. Any
    one, let me know the solution for that.

    Hi,
    The Primary cause of the whole problem is the use of V2
    components. Please
    Emulate the scenario with movie clips and that should work.
    Rendering of V2
    components is a tedious task for the player and is not
    recommended for
    flashLite. Using some workarounds might help in dire need,
    when you use
    randomly generated movie clips to emulate the datagrid or the
    data set and
    write your own parser to replace the XML connector component,
    custom buttons
    can always be used other than the button component
    Regards,
    Debashish Paul
    "netsoul" <[email protected]> wrote in
    message
    news:eievp9$5do$[email protected]..
    > Dear Vijayan,
    >
    > The error 'Action Script Stuck' is a great problem in FL
    2.1. The reason
    > of
    > that error is not only in the internal processes in
    flash player, but in
    > incorrect work 3-d part applications, that do not free
    resources on time.
    > The
    > investigation that problem on real devices (WM5 &
    BREW) detected, that the
    > error 'Action Script Stuck' appears in very simple
    scripts, when FL 2.1
    > player
    > is really freezed by another application because of lack
    of resources.
    >
    > My opinion - the mechanism of detecting 'Action Script
    Stuck' must be
    > improved
    > to separate internal and external reasons. That
    > applys to FL 2.1 for BREW too.
    >
    > Sincerely,
    > Alex
    >

  • UCCX 8.5.1 Scripting Assistance - Set Priority

    Hello,
    I am trying to configure the priority in my script similar to how they did this in the below discussion. 
    https://supportforums.cisco.com/discussion/11892936/uccx-851-basic-scripting-assistance-set-priority
    When I put the "set priority" in the script it errors out and callers hear the message that the system is experiencing problems.  The script runs fine without the "set priority".  Any assistance would be greatly appreciated.

    Chris,
    I attempted to validate the script and did get an error with the "Set Enterprise Call Info" step.  What's odd is that without the priority step the script still does not validate, but actually works fine.  As soon as I add the priority step to it though it breaks.
    I removed the "Set Enterprise Call Info" step and the priority works as expected now.  Thank you for your assistance.
    Jared

  • How to create the Sap script & Layout Set (wants sample code)

    Hi All ,
    Can you please provide me the step by step procedure
    to create the Sap script & Layout Set .(please provide sample
    code/links /docs for layout & print program).
    Regards
    Rahul

    hi,
    go through the following links  what i found to create sap script.
    http://www.thespot4sap.com/Articles/SAPscript_Introduction.asp
    http://abapliveinfo.blogspot.com/2008/01/free-sapscript-made-easy-46-book.html
    http://www.thespot4sap.com/articles/SAPscript_example_code.asp
    http://idocs.de/www3/cookbooks/sapscript/sapscript_1/docu.htm
    http://idocguru.com/www5/cookbooks/sapscript/sapscript_1/example.htm
    www.geocities.com/wardaguilar25/sapscript-tutorial.html
    http://logosworld.de/www3/cookbooks/sapscript/sapscript_8/docu.htm
    how to create a  scripts?give steps?
    https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=2969311
    https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=2902391
    https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=3205653
    https://forums.sdn.sap.com/click.jspa?searchID=1811669&messageID=3111402
    http://www.sap-img.com/sapscripts.htm
    http://sappoint.com/abap/
    http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm
    http://help.sap.com/saphelp_crm40/helpdata/en/16/c832857cc111d686e0000086568e5f/content.htm
    http://www.sap-basis-abap.com/sapabap01.htm
    http://www.sap-img.com/sapscripts.htm
    http://searchsap.techtarget.com/tip/1,289483,sid21_gci943419,00.html
    http://sap.ittoolbox.com/topics/t.asp?t=303&p=452&h2=452&h1=303
    http://www.sapgenie.com/phpBB2/viewtopic.php?t=14007&sid=09eec5147a0dbeee1b5edd21af8ebc6a
    Other Links

  • Quicktime gets a file not found error in running of set up.  tried downloading twice

    Quicktime gets a file not found error in running of set up.  tried downloading twice

    Hi Spex,
    I can import the VI Logger task OK (from another PC running VI Logger 2.0), but I can't run the task.  I've attached the file.  The "1 channel" task runs OK.  The "x-probe" task starts, takes 1 or 2 data points, then hangs for a few seconds, then pops up the "file not found" error. The data acquisition taks run OK, so I don't think they're the problem.
    This file I've attached includes 2 good data tasks ("1 channel" and xprobe"), 1 good VI Logger task ("1 channel"), and my non-working VI Logger task ("x-probe", which works fine on the PC it was exported from).
    I have also tried exporting the non-working VI Logger task on its own, and it still imports OK, but still doesn't run, and gives the same error.
    Thanks,
    Jake
    Attachments:
    configData1.zip ‏353 KB

Maybe you are looking for