📜 ⬆️ ⬇️

Fast ranking in iTunes

The task: to make a hot key, in which the desired rating for a playing song would be set in iTunes, as a bonus - a mass setting of the rating for several songs.

Solution: since we have only 5 rating options (this is an interface, in fact, a gradation from 0 to 100), we will need to write 5 AppleScript scripts and hang our hot key on each script.

Below is a generic script that allows you to put down a rating for the following situations:

(*

set rating of current track

*)

--define properties
property Rate_1 : 20
property Rate_2 : 40
property Rate_3 : 60
property Rate_4 : 80
property Rate_5 : 100

--change rating

tell application "iTunes"

set trackCount to count (get selection)

set playingTrack to current track

if trackCount is greater than 1 then

repeat with theTrack in (get selection)

set the rating of theTrack to Rate_5

end repeat

else if ((trackCount = 0) or (trackCount = 1)) then

set the rating of playingTrack to Rate_5

end if

end tell


In order to make 5 scripts, simply substitute the desired value from the Properties block into the script you need.
In order to hang the script on the hotkey, do the following:

* for some machines it is necessary to restart the SystemUIServer process after step 3

')

Source: https://habr.com/ru/post/58487/


All Articles