Resizing Windows

I would like to resize a window a bit like System preferences or most other preference windows when I change tabs (hide/unhide custom views), the closest I can get this effect is:

windd's setFrame_display_animate_({{item 1 of (item 1 of (windd's frame() as list) as list), (item 2 of (item 1 of (windd's frame() as list) as list)) + ((item 2 of (item 2 of (windd's frame() as list) as list)) - 200)}, {900, 200}}, true, true)

And setting the size I want by changing those numbers, this is long, and sounds a bit too hard to be true, is there a more automatic or shorter way?

As you’ve posted it, you’re getting the window’s frame three times, and it’s not exactly reader-friendly. Your code will make more sense when you come back to it if you use something like this:

		set theFrame to windd's frame()
		set {{x:x1, y:y1}, {width:theWidth, height:theHeight}} to theFrame as list
		windd's setFrame_display_animate_({{x1, y1 + theHeight - 200)}, {900, 200}}, true, true)

Thanks, it’s much easier now.