hey francola,
odd coincidence that I found this, I have been trying to make this a little more elegant as well.
here is the latest post for me in the macthemes thread:
http://macthemes2.net/forum/viewtopic.php?pid=416801#p416801
Something I am very interested in, is creating a script that will:
Get bounds info of all open windows of all applications
Then I would like to create another script that would set the bounds of those particular applications to the earlier result.
basically, a script to run to set the position of your windows.
and another one to reset the positions and size to that stored value.
Maybe this could be done by having the first script write a text file (preference file) with the window bound info, then have the second usage script use that stored info?
if this is possible all help would be appreciated.
here is the script I am currently using as a solution to organize my commonly used non full-screen windows. Works both on the single display of my MBP or when connected to my Cinema Display to move itunes over to the extended desktop.
--GET SCREEN INFORMATION
tell application "Finder"
set currwindow to front window
set screen_resolution to bounds of window of desktop
set screen_width to item 3 of screen_resolution
set screen_height to item 4 of screen_resolution
set the sidebar width of currwindow to {0}
end tell
--SET DESIRED WIDTH OF BASIC WINDOWS (DUAL DISPLAY)
set desired_width to 1440
--SET BASIC SCREEN POSITION (Left, Right, Top, Bottom)
set left_bound to 22
if screen_width > 1920 then
set right_bound to left_bound + desired_width
else
set right_bound to screen_width - 220
end if
set top_bound to 46 (* for the menu bar *)
set bottom_bound to screen_height - 22
--SET ITUNES DESIRED WIDTH (DUAL DISPLAY)
set iTunesdesired_width to 1600
--SET ITUNES SCREEN POSITION (Left, Right, Top, Bottom)
set iTunesleft_bound to 1947
set iTunesright_bound to screen_width - 22
set iTunesbottom_bound to screen_height - 22
set iTunestop_bound to -100
--POSITION APPLICATIONS
try
tell application "Firefox"
activate
set the bounds of the first window to {left_bound, top_bound, right_bound, bottom_bound}
end tell
end try
try
tell application "iTunes"
activate
if screen_width > 1920 then
set the bounds of the first window to {iTunesleft_bound, iTunestop_bound, iTunesright_bound, iTunesbottom_bound}
else
set the bounds of the first window to {left_bound, top_bound, right_bound, bottom_bound}
end if
end tell
end try
--SIZE AND POSITION FINDER WINDOWS
tell application "Finder"
activate
set bounds of Finder window 1 to {675, 83, 1700, 609}
set bounds of Finder window 2 to {675, 647, 1700, 1172}
end tell
(looking at this, it could be simplified by just using the bound info generated by these other scripts, there MUST be a way to take all the info returned from the below scripts, and save them in a text or .plist file that the usage script can reference for the sizes right?
and the scripts to return the bounds info:
For Finder:
tell application "Finder"
get bounds of windows
end tell
For Firefox (or other apps):
tell application "Firefox"
get bounds of first window
end tell
Model: MacBook Pro 17" 2.4
Browser: Firefox 3.0.6 GTB5 Ubiquity/0.1.5
Operating System: Mac OS X (10.5)