I wanted some hot-keys to move windows to the far edges of screens on my laptop. As such, I made some AppleScripts, and assigned them to opt-cmd-(arrows).
As an example, here is the the move_left script:
tell application "Finder"
set {disp_x1, disp_y1, disp_x2, disp_y2} to bounds of window of desktop
end tell
tell application "System Events"
set frontmostApplication to name of the first process whose frontmost is true
end tell
tell application frontmostApplication
set {x1, y1, x2, y2} to bounds of window 1
set bounds of window 1 to {disp_x1, y1, disp_x1 + x2 - x1, y2}
end tell
Unfortunately, just picking window 1 doesn't work in all applications. In Adium it results in the menu-bar icon getting moved around the screen. In Firefox, nothing happens at all.
Can somebody help me figure out how to choose the select application window correctly, so that this might work correctly? I'd greatly appreciate it, as I never even looked at AppleScript until a day ago.