|
Page 1 of 2 Every so often while working on a project or playing a game in OS X my Finder windows get messed up. I guess you could say I have a bit of OCD, but I like my Finder configuration. And when it gets changed or messed up it drives me crazy.
I have 2 windows on top that are about half the width of the screen, with 1 window on bottom the full width of the screen. I use these 3 windows all in column view, which is the most efficient way to navigate the file system. (This is probably my biggest gripe with Windows—there is no column view.) This setup allows me to be viewing one or two directories while having a 3rd for moving files around. When this setup gets messed up I have to fix it. And since the windows are of different sizes I can't always just make a new window to fill in the gap. Today I finally decided to write an applescript to fix my finder windows when they get out of whack. I have decided to share it just in case there is someone out there who will find it useful, or even help them with their own applescript. I gathered the parts for this script from various places on the Internet. (Thank goodness for Google.)Feel free to modify and do whatever you want with the following Applescript. To use: copy the text into a new Apple Script inside the Script Editor, then save the script as an application or other executable script. When testing the following script this morning on my Mac with dual monitors... it didnt work since the screen_resolution variable was set to include the width of both monitors put together. property kDistance : 20 property kDockHeight : 50
tell application "Finder" set screen_resolution to bounds of window of desktop set screen_width to item 3 of screen_resolution set screen_height to item 4 of screen_resolution set half_width to (screen_width div 2) set half_height to ((screen_height div 2) - (kDistance * 2)) --Close all the old windows repeat with i from 1 to count of Finder windows close Finder window 1 end repeat --Setup 1st Window set newWin to make new Finder window tell newWin set the bounds to {kDistance, kDistance * 3, half_width, half_height} set the target to (path to home folder) set the current view to column view end tell --Setup 2nd Window set newWin to make new Finder window tell newWin set the bounds to {half_width + (kDistance * 2), kDistance * 3, screen_width - kDistance, half_height} set the target to (path to home folder) set the current view to column view end tell --Setup 3rd Window set newWin to make new Finder window tell newWin set the bounds to {kDistance, half_height + (kDistance * 2), screen_width - kDistance, screen_height - kDockHeight} set the target to (path to home folder) set the current view to column view end tell end tell The following applescript was updated to work with dual monitors. However, this solution seems hackish to me and doesn't work on all systems the same. You will need to change the part that says "Word 6 of" to correspond with the monitor that you wish the script to work with. Alternately you can set the screen_width and screen_height variables to a static number. property kDistance : 20 property kDockHeight : 50
tell application "Finder" set screen_resolution to {word 6 of (do shell script "defaults read /Library/Preferences/com.apple.windowserver | grep -w Width") as number, word 6 of (do shell script "defaults read /Library/Preferences/com.apple.windowserver | grep -w Height") as number} set screen_width to item 1 of screen_resolution set screen_height to item 2 of screen_resolution set half_width to (screen_width div 2) set half_height to ((screen_height div 2) - (kDistance * 2)) --Close all the old windows repeat with i from 1 to count of Finder windows close Finder window 1 end repeat --Setup 1st Window set newWin to make new Finder window tell newWin set the bounds to {kDistance, kDistance * 3, half_width, half_height} set the target to (path to home folder) set the current view to column view end tell --Setup 2nd Window set newWin to make new Finder window tell newWin set the bounds to {half_width + (kDistance * 2), kDistance * 3, screen_width - kDistance, half_height} set the target to (path to home folder) set the current view to column view end tell --Setup 3rd Window set newWin to make new Finder window tell newWin set the bounds to {kDistance, half_height + (kDistance * 2), screen_width - kDistance, screen_height - kDockHeight} set the target to (path to home folder) set the current view to column view end tell end tell
|
Comment by GUEST on 2008-07-29 09:43:46 I like your OCD. :) | Comment by GUEST on 2008-08-10 15:15:03
| Comment by GUEST on 2008-08-16 22:33:05 holy crap! thank you so much! i have been looking everywhere for a solution to my finder problems. you are amazzzing!! | Comment by GUEST on 2008-08-22 17:12:31 "I have decided to share it just in case there is someone out there who will find it useful, or even help them with their own applescript." Thanks for doing this. I'm finding it very useful already. I'd always use two finder windows, but three finder windows in the configuration you showed makes a heck of a lot more sense! And it almost completely reduces the need to purchase something like Pathfinder, although there are some bells and whistles there that would be nice in Finder. But that is another discussion! Thanks again! --Mark
| Comment by GUEST on 2008-12-12 23:48:25 that was just what i was looking for. thanks
| Comment by GUEST on 2009-01-04 21:38:58 I expand it a little. Not open, loads as per original Open but hidden, show Open and visible, hide property kDistance : 20 property kDockHeight : 50 tell application "Finder" set theCount to the count of Finder windows end tell tell application "System Events" if not (exists process "Finder") then my Triview() else if theCount < 3 or theCount > 3 then --Close all the old windows tell application "Finder" repeat with i from 1 to count of Finder windows close Finder window 1 end repeat end tell my Triview() else not (visible of process "Finder") set visible of process "Finder" to the result end if end if end tell on Triview() -- load Triview tell application "Finder" set screen_resolution to bounds of window of desktop set screen_width to item 3 of screen_resolution set screen_height to item 4 of screen_resolution set half_width to (screen_width div 2) set half_height to ((screen_height div 2) - (kDistance * 2)) --Setup 1st Window set newWin to make new Finder window tell newWin set the bounds to {kDistance, kDistance * 3, half_width, half_height} set the target to (path to home folder) set the current view to column view end tell --Setup 2nd Window set newWin to make new Finder window tell newWin set the bounds to {half_width + (kDistance * 2), kDistance * 3, screen_width - kDistance, half_height} set the target to folder ("macintosh hd:applications") set the current view to list view end tell --Setup 3rd Window set newWin to make new Finder window tell newWin set the bounds to {kDistance, half_height + (kDistance * 2), screen_width - kDistance, screen_height - kDockHeight} --set the target to disk "Scott Rhamy's Time Capsule" set the current view to list view end tell end tell end Triview
| Comment by GUEST on 2009-02-03 18:20:09 Thanks very much for this great script. It is just what I have been looking for. | Comment by GUEST on 2009-02-21 13:48:16 No need to loop through the FInder windows: tell application "Finder" to close windows --Christopher Stone | Comment by GUEST on 2009-04-05 12:37:05 I love that people keep finding this script and it's been quite a bit of time since the last update. I have a new question. I'm not sure how it happened, perhaps in a system update, but this script while still running fine, creates my new finder windows without the toolbars showing. And while it is easy enough to click the chicklet in the upper right hand corner of the window, my dimensions are then out of whack. I was hoping someone can clue me in on how to force the toolbar to show. I've scoured the net to the best of abilities and have found nothing, so I figured why not go to the source! =] Thanks in advance! Mark | Comment by GUEST on 2009-07-21 08:34:58 ko3gKs gaeawwoiabxy, [url=http://yunkbrekdcly.com/]yunkbrekdcly[/url], [link=http://psjrakrenmru.com/]psjrakrenmru[/link], http://rmkwiquzucdo.com/ |
<< Start < Previous 1 2 Next > End >> |