How Do I Manipulate Windows in AppleScript?

In addition to my above macro, here are some other examples:

Did you take a look at: