Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Updated script to create dual Finder windows Apps
I revisited this hint recently. This script should be compatible with Tiger and higher system versions. It tries to make tandem windows from bottom of the screen up from the first two eligible Finder windows. If only one eligible window is available, it uses that one and creates another, and if no eligible windows are available, it creates and arranges two. It doesn't respect Spaces, so if a single eligible window exists, the existing window and the new window may end up in different spaces.

Here is the modified script. You can save it to ~/Library/Scripts/Applications/Finder to make it available from the AppleScript menu. You may need to create the Finder folder.
set danswer to (do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep Resolution")
set monitor_width to (word 2 of danswer) div 1
set monitor_height to (word 4 of danswer) div 1
set hit1 to false
set hit2 to false
tell application "Finder"
 activate
 set window_count to the count of windows
 repeat with i from 1 to window_count
  try
   if not hit1 then
    set the current view of window i to column view
    set the bounds of window i to {0, ((monitor_height * 0.33) div 1 - 23), monitor_width, (monitor_height * 0.66) div 1 - 23}
    set hit1 to true
    if not hit2 then
     set the current view of onenewwin to column view
     set the bounds of onenewwin to {0, (monitor_height * 0.66) div 1, monitor_width, monitor_height}
     set hit2 to true
     exit repeat
    end if
   else
    set the current view of window i to column view
    set the bounds of window i to {0, (monitor_height * 0.66) div 1, monitor_width, monitor_height}
    set hit2 to true
    exit repeat
   end if
  end try
 end repeat
 if hit1 and hit2 then
 else if hit1 then
  set newwin to make new Finder window
  set the current view of newwin to column view
  set the bounds of newwin to {0, (monitor_height * 0.66) div 1, monitor_width, monitor_height}
 else if not hit1 and not hit2 then
  set onehit to 2
  set onenewwin to make new Finder window
  set the current view of onenewwin to column view
  set the bounds of onenewwin to {0, ((monitor_height * 0.33) div 1 - 23), monitor_width, (monitor_height * 0.66) div 1 - 23}
  set twonewwin to make new Finder window
  set the current view of twonewwin to column view
  set the bounds of twonewwin to {0, (monitor_height * 0.66) div 1, monitor_width, monitor_height}
 end if
end tell


[crarko adds: I tested it in 10.6.4, and it works as described. The AppleScript source is mirrored here.]
    •    
  • Currently 2.16 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (19 votes cast)
 
[6,146 views]  

Updated script to create dual Finder windows | 10 comments | Create New Account
Click here to return to the 'Updated script to create dual Finder windows' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Updated script to create dual Finder windows
Authored by: hamarkus on Aug 20, '10 04:42:52PM

Doesn't Cinch already does more or less the same thing?



[ Reply to This | # ]
Updated script to create dual Finder windows
Authored by: llee on Aug 22, '10 11:43:09AM

I think Cinch lets you use a mouse gesture to resize a window so that it takes up either half your screen horizontally so you can quickly resize two windows to occupy the entire screen side by side. The two windows can be from any application and don't have to be from the same one. Cinch isn't free, though.



[ Reply to This | # ]
Updated script to create dual Finder windows
Authored by: roatan on Aug 20, '10 08:09:51PM

I'd like to see this with vertical windows, side by side, list view. I managed to get list view to work, but not vertical windows, with an offset to push them out 40 pixels from the left, to accommodate the dock on the left.



[ Reply to This | # ]
Updated script to create dual Finder windows
Authored by: Chibby on Aug 21, '10 06:08:55AM
Had the same idea .. here u go:

set danswer to (do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep Resolution")
set monitor_width to (word 2 of danswer) div 1
set monitor_height to (word 4 of danswer) div 1
set hit1 to false
set hit2 to false
tell application "Finder"
activate
set window_count to the count of windows
repeat with i from 1 to window_count
try
if not hit1 then -- place first window / left
set the current view of window i to list view
set the bounds of window i to {40, 0, (monitor_width * 0.5) div 1 + 20, monitor_height}
set hit1 to true
if not hit2 then -- place second window / right
set the current view of onenewwin to list view
set the bounds of onenewwin to {(monitor_width * 0.5) div 1 + 20, 0, monitor_width, monitor_height}
set hit2 to true
exit repeat
end if
else -- if first window already placed - proceed with second / right window
set the current view of window i to list view
set the bounds of window i to {(monitor_width * 0.5) div 1 + 20, 0, monitor_width, monitor_height}
set hit2 to true
exit repeat
end if
end try
end repeat
if hit1 and hit2 then -- both windows already placed -> exit
else if hit1 then -- first / left window already placed - create second / right
set newwin to make new Finder window
set the current view of newwin to list view
set the bounds of newwin to {(monitor_width * 0.5) div 1 + 20, 0, monitor_width, monitor_height}
else if hit2 then -- second / right window already placed - create first / left
set newwin to make new Finder window
set the current view of newwin to list view
set the bounds of newwin to {40, 0, (monitor_width * 0.5) div 1 + 20, monitor_height}
else if not hit1 and not hit2 then -- create two new windows
set onehit to 2
set onenewwin to make new Finder window
set the current view of onenewwin to list view
set the bounds of onenewwin to {40, 0, (monitor_width * 0.5) div 1 + 20, monitor_height}
set twonewwin to make new Finder window
set the current view of twonewwin to list view
set the bounds of twonewwin to {(monitor_width * 0.5) div 1 + 20, 0, monitor_width, monitor_height}
end if
end tell


btw - there is a bug with creating the second window, if one already exists .. its this part from the code above (added to modified original hint):

...

else if hit2 then -- second / right window already placed - create first / left
set newwin to make new Finder window
set the current view of newwin to list view
set the bounds of newwin to {40, 0, (monitor_width * 0.5) div 1 + 20, monitor_height}

...


Big question .. this is the first time for me posting code here. .. how to format it?? It's really a pain using html "br"s all over the place... Thanks

[ Reply to This | # ]
Updated script to create dual Finder windows
Authored by: ricede on Aug 21, '10 04:00:50AM

can anyway please tell me how to set this up so the finder windows open in the user home setting - rather than the macintosh harddrive



[ Reply to This | # ]
Updated script to create dual Finder windows
Authored by: Zeitkind on Aug 21, '10 08:06:04AM

Well..
$ /usr/sbin/system_profiler SPDisplaysDataType | grep Resolution
Resolution: 1600 x 1200 @ 60 Hz
Resolution: 1600 x 1200 @ 60 Hz
Resolution: 1920 x 1200 @ 60 Hz

Guess the script needs a little more finish.. ;)



[ Reply to This | # ]
Updated script to create dual Finder windows
Authored by: regulus on Aug 21, '10 08:45:09AM
FYI: creating and restoring Finder windows can be done easily with my application Simple WindowSets. You might find it useful. You can check it out on my website here.

[ Reply to This | # ]
Updated script to create dual Finder windows
Authored by: llee on Aug 22, '10 11:32:34AM

In Reply to ricede:

There are three lines in the script containing the word "make". Replace each of those entire lines as follows.

Replace the first with the following three line script:

tell application "Finder"
set newwin to make new Finder window to home
end tell

Replace the second with the following three line script:

tell application "Finder"
set onenewwin to make new Finder window to home
end tell

Replace the third with the following three line script:

tell application "Finder"
set twonewwin to make new Finder window to home
end tell

You'll notice that the only differences between the above three scripts are the variable names "newwin", "onenewwin", and "twonewwin".

Edited on Aug 22, '10 11:33:30AM by llee



[ Reply to This | # ]
Updated script to create dual Finder windows
Authored by: llee on Aug 22, '10 05:15:48PM

I forgot that all this stuff was already in a Finder "tell" block (silly me!) so it doesn't need so many changes.

In Reply to ricede:

There are three lines in the script containing the word "make". Replace each of those entire lines as follows.

Replace the first with the following line:

set newwin to make new Finder window to home


Replace the second with the following line:

set onenewwin to make new Finder window to home


Replace the third with the following line:

set twonewwin to make new Finder window to home


You'll notice that the only differences between the above three scripts are the variable names "newwin", "onenewwin", and "twonewwin".



[ Reply to This | # ]
Updated script to create dual Finder windows
Authored by: ricede on Aug 23, '10 06:11:35AM

thanks llee



[ Reply to This | # ]