Split frontmost application's frontmost two windows
Alec Jacobson
November 03, 2010
Here's a handy applescript to split your frontmost application's front most two windows on the main display:
set main_display_size to get_main_display_size()
set main_display_width to item 1 of main_display_size
set main_display_height to item 2 of main_display_size
tell application "System Events"
set frontmostApplication to name of the first process whose frontmost is true
end tell
tell application frontmostApplication
set bounds of first window to {0, 0, main_display_width / 2, main_display_height}
set bounds of second window to {main_display_width / 2, 0, main_display_width, main_display_height}
end tell
on get_main_display_size()
set command to "/usr/sbin/system_profiler SPDisplaysDataType"
set output to (do shell script command)
set AppleScript's text item delimiters to "Resolution: "
set displays to text items of output
set i to 2
repeat ((length of displays) - 1) times
if (offset of "Main Display: Yes" in (item i of displays)) is not equal to 0 then
set word_list to words of item i of displays
set main_display_width to item 1 of word_list
set main_display_height to item 3 of word_list
end if
set i to i + 1
end repeat
return {main_display_width as integer, main_display_height as integer}
end get_main_display_size
Note:This only works if you save this an a .scpt script file, not as an application as it will just think itself is the frontmost application and do nothing.