Created
May 19, 2010 01:52
-
-
Save cowboy/405851 to your computer and use it in GitHub Desktop.
another applescript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set minX to 0 | |
set minY to 22 | |
tell application "Finder" to set screen_resolution to items 3 thru 4 of (get bounds of desktop's window) | |
set maxX to item 1 of screen_resolution | |
set maxY to item 1 of screen_resolution | |
--set maxX to (do shell script "echo $(defaults read /Library/Preferences/com.apple.windowserver) | sed 's/.*Width = \\([0-9]*\\);.*/\\1/'") as number | |
--set maxY to ((do shell script "echo $(defaults read /Library/Preferences/com.apple.windowserver) | sed 's/.*Height = \\([0-9]*\\);.*/\\1/'") as number) - 4 | |
set width to maxX --1024 | |
set myBounds to {maxX - width, minY, maxX, maxY} | |
--tell application "System Events" to set frontApp to title of (first process whose frontmost is true) | |
set frontApp to "Safari" | |
tell application frontApp | |
try | |
set allWindows to (every document) | |
if (the (count of allWindows) = 0) then | |
set defaultPage to do shell script "defaults read com.apple.internetconfig | egrep '^ *WWWHomePage' | sed 's/^.*\" = \"\\(.*\\)\".*$/\\1/'" | |
make new document with properties {URL:defaultPage} | |
else | |
reopen | |
end if | |
set the bounds of front window to myBounds | |
activate | |
end try | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment