title: Applescript to change rating of song currently playing in iTunes
body: <p>I set up an applescript to change the rating of the current song in iTunes and it worked the first few times but now does nothing. Here is the code:</p>
  
  <pre><code>tell application "System Events"
      if (name of processes) contains "iTunes" then
          set iTunesRunning to true
      else
          set iTunesRunning to false
      end if
  end tell
  
  if iTunesRunning then
      tell application "iTunes"
          repeat with theTrack in (get selection)
              set the rating of theTrack to 100
          end repeat
      end tell
  end if
  </code></pre>
  
  <p>Anyone see any glaring issues in there? FYI, this is attached to a global hotkey, but even opening it in Applescript Editor and hitting "Run" does nothing.</p>