iTunes window bounds don't stay

Whenever I try to set the bounds of the main iTunes window with this:

tell application "iTunes"
	set bounds of window 1 to {180, 101, 1400, 960}
	get bounds of window 1
end tell

I get {180, 122, 1400, 960}, which is not the same (the 2nd value is different). Is there any reason why this happens and is there anything I can do to get around it?

It seems that iTunes adds 21 if you use the get command. Maybe for the title bar? Then you should see the place just beneath the close button as the left-upper corner. The set command seems to work as expected.

tell application "iTunes"
	set bounds of window 1 to {100, 50, 900, 800}
	my getRealBoundsOfiTunes()
end tell

on getRealBoundsOfiTunes()
	tell application "iTunes" to set v to bounds of window 1
	set item 2 of v to (item 2 of v) - 21
	return v
end getRealBoundsOfiTunes

Hope it helps,
ief2

I’m trying to plug that into my script, but I’m not sure where it belongs.

This is my script, which sets the bounds of a window just where I want it (depending on the app, but for now, I’ll use iTunes). If the window is already where I want it, the script will maximize it.

global DTbounds, frontApp

-- set essentials
tell application "Finder" to set DTbounds to get bounds of window of desktop
tell application "System Events" to ¬
	set frontApp to displayed name of process 1 whose frontmost = true

on moveWindow(appName, whichWindow, appBounds)
	if application appName is running then
		tell application appName
			if appName contains frontApp then
				try
					if bounds of window whichWindow ≠ appBounds then
						set bounds of window whichWindow to appBounds
					else if bounds of window whichWindow = appBounds then
						set bounds of window whichWindow to DTbounds
					end if
				end try
			end if
		end tell
	end if
end moveWindow

moveWindow("iTunes", 1, {180, 80, 1400, 960})

So how should I fit your suggestion into my script?