Help with iTunes script

I want to set the volume level of every track in the library whose bit rate is 192 to 100.
My script (below) will not select the desired tracks nor does it understand the set volume adjustment line.

Sorry for my inexperience as a scripter.

tell application “iTunes”
set thetracks to tracks of library playlist whose bit rate is 192 and volume adjustment is not 100
repeat with eachtrack in thetracks
set volume adjustment of eachtrack to 100
end repeat
end tell

Hi,

the dictionary of iTunes is a bit confusing because there are a few undocumented items.
library playlist(s) is an element which can contains multiple playlists,
so you have to reference the playlist by index


set thetracks to tracks of library playlist 1 whose bit rate is 192 and volume adjustment is not 100

or you use the source by name


set thetracks to tracks of source "Library" whose bit rate is 192 and volume adjustment is not 100

Thanks Stefan,

That does correct the first problem. The other problem is that applescript doesn’t like the command

set volume adjustment of eachtrack to 100

The word “to” is highlighted.

This script, when it does run, will take a while because my library is so large. Any way to speed things up would also be appreciated.

it looks like a compiler bug.
At least this syntax compiles


set (volume adjustment) of eachtrack to 100

This compiles, too


set eachtrack's volume adjustment to 100

Thanks again Stefan,

The first suggestion did not work - unknown object

The second one did work.

You’re awesome.