PDA

View Full Version : Applescript to move Safari window to second monitor!




MagicTramp
Jun 30, 2009, 08:47 AM
I use Safari on my second monitor.
Every now and then i drag the window down to my MBP screen, then need to drag it back up to my second monitor; stretching it etc. until it fits the screen.

ANNOYING!

I need an applescript to tell the safari window to move up to the second monitor and fit the screen.

I have a similar script for FInder. One script takes a 'stamp' of the finder window size, and another script recalls that size. However the 'stamp' script (when i change all "Finder" words to Safari) cannot compile. Here it is...

set PrefsPath to (path to preferences as text)

do shell script ("mkdir -p " & quoted form of POSIX path of (PrefsPath & "FinderSize"))

set dataFilePath to PrefsPath & "FinderSize:Finder Window Bounds.dat"

tell application "Finder" to set FinderWindowOpen to ((count each Finder window) > 0)

if (FinderWindowOpen) then
tell application "Finder" to set theBounds to bounds of front Finder window

set fRef to (open for access file dataFilePath with write permission)
try
set eof fRef to 0
write theBounds to fRef
end try
close access fRef
end if

Can i make this work for Safari? Or is there an easier way? Thanks! :D