Launch Script Editor

06 April 2007

AppleScript Studio: Center all windows and panels

Your application may use several windows and panels. The main window, the search panel, the progress panel and so on.

The user can move them freely on the screen and it's a good practice to save and remember those positions.

But if for any reason you want to reset the windows positions and center them, there's a sweet little command to do it:

tell every window to center

This will affect visible and hidden windows (and panels). You can call it on the awake from nib handler to center at startup.

It may be useful in a multi-screen computer, to rejoin all windows on the main display.

1 comentários:

Valentijn Langendorff said...

TIP: this will get the url, send it to a window loading delicious api, set the window nicely to a dialog kind of size, tags etc etc. After logged in it will remember the account settings ofcourse...
This is the best option for me as I can try to make it crossplatform. As Firefox 3 has not as much extensions at the moment... yet as well as other beta browsers etc etc

Ciao!

Applescript to save url bookmark to Delicious from Safari !

tell application "Safari"
set theurl to (get URL of document 1)
end tell


tell application "Safari"
activate
open location "http://del.icio.us/YOUR_ACCOUNT_NAME?noui=yes&jump=close&url=" & theurl
set bounds of window 1 to {200, 200, 900, 550}
end tell