Isn't there a way...
Isn't there a way...
- Subject: Isn't there a way...
- From: Glenn Sugden <email@hidden>
- Date: Sun, 27 Jul 2003 15:08:35 -0500
...to write a generic-ish 'center front window' script? I understand that
the application has to be scriptable, but when running the script (from
Script Menu), the front windows seems to (often) be taken out of focus...
When running from a script editor, it works fine...
Thanks in advance!
::Glenn
---
tell application "System Events"
set front_app_name to name of front process whose visible is true and
frontmost is true
end tell
tell application front_app_name
set screen_list to screen list starting with main screen
set main_screen to item 1 of screen_list
set main_screen_bounds to bounds of main_screen
set main_screen_width to (item 3 of main_screen_bounds) - (item 1 of
main_screen_bounds)
set main_screen_height to (item 4 of main_screen_bounds) - (item 2 of
main_screen_bounds)
set window_bounds to bounds of front window
set window_width to (item 3 of window_bounds) - (item 1 of
window_bounds)
set window_height to (item 4 of window_bounds) - (item 2 of
window_bounds)
set x to (main_screen_width - window_width) / 2
set y to (main_screen_height - window_height) / 2
set bounds of front window to {x, y, x + window_width, y +
window_height}
end tell
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.