Hi there,
My first post…
I got bored with to many windows on my screen.
So I wrote this script to organize them.
It works for all open en scriptable applications.
Maybe it the script already exists.
Just playing around en learning new things.
Cheers Pieter
-- SETTINGS --
set X_size to 1500 --> X size window
set Y_size to 900 --> Y size window
set X_left to 50 --> distance from left of the screen
set X_dif to 50 --> X distance between windows
set Y_top to 24 --> distance from top of the screen
set Y_dif to 20 --> Y distance between windows
-- INFO OPEN APPLICATIONS --
tell application "System Events"
set app_open_arr to the name of every process whose visible is true
set app_open_int to count of app_open_arr
end tell
-- INFO NUMBERS OF WINDOWS --
set win_open to 0
repeat with i from 1 to app_open_int
try
tell application (item i of app_open_arr)
set win_open to win_open + (number of (every window whose visible is true))
end tell
end try
end repeat
-- SORTING WINDOWS --
set X_next to X_left + X_dif * (win_open - 1)
set Y_next to Y_top
repeat with i from 1 to app_open_int
tell application (item i of app_open_arr)
try
if number of (every window whose visible is true) > 0 then
activate
repeat with j from 1 to count (index of every window whose visible is true)
if item i of app_open_arr is not "Finder" then
set bounds of window j to {X_next, Y_next, (X_next + X_size), (Y_next + Y_size)}
else
set bounds of window j to {X_next, Y_next + 20, (X_next + X_size), (Y_next + Y_size)}
end if
set X_next to X_next - X_dif
set Y_next to Y_next + Y_dif
tell application "System Events"
tell process (item i of app_open_arr)
set frontmost to true
perform action "AXRaise" of window j
end tell
end tell
end repeat
end if
end try
end tell
end repeat