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

An AppleScript to create dual Finder windows Desktop
Here is the most useful Applescript I have found yet. It will open two Finder windows stacked above one another in a similar fashion to Rob's preferred Finder set-up as described in his guide. The beauty of this script (or an appropriately modified version of it) is that it can be launched from the dock at any time to give you your own preferred Finder window set-up.

I found the original script on Apple's Applescript site, which is well worth a visit if you haven't been there lately!

This particular script is designed for people who like to have two finder windows in column view stacked one above the other, filling a large portion of the screen. Download the script from my iTools web site.

Read the rest of this article for the source of the script, as well as some comments on tweaking it for your particular machine.

NOTE: This may not work with a direct copy and paste.
property monitor_width : 980
property monitor_height : 768
set the startup_disk to (path to startup disk)
tell application "Finder"
activate
set visible of (every process whose visible is true and frontmost is false)
to false
-- BOTTOM WINDOW
set this_window to make new Finder window
set the target of this_window to the startup_disk
set the bounds of this_window to {0, (monitor_height * 0.55) div 1,
monitor_width, monitor_height}
set the current view of this_window to column view
-- TOP WINDOW
set this_window to make new Finder window
set the target of this_window to the startup_disk
set the bounds of this_window to {0, (monitor_height * 0.06) div 1,
monitor_width, (monitor_height * 0.53) div 1}
set the current view of this_window to column view
end tell
This particular script is optimized for my powerbook at 1024x768 resolution with the dock on the right hand side. I have a modified version for my work computer running at 1600x1200. You will need to edit yours to suit your own set-up.

Key lines to edit are:

property monitor_width : 980
property monitor_height : 768

These dictate the screen space available to the script. These settings leave just enough free space on the right hand side for my dock. Reduce 980 to a lower number if you want more space on the right.

To adjust this script for different screen resolutions you will also need to edit the two "monitor_height" fractional percentage values. Experiment a bit to find the settings that work for you. To do this, edit the script with script editor (/Applications/AppleScript/Script Editor) and then run the script to see the effect of your edits before you save.

Once you have the script running to your own standards of perfection, save it as an application (mine is called 'tandem' and is located in the /Application/AppleScript directory). Now here is the "real" hint:

Drag the icon of the new "tandem" applescript to your dock!

From now on, whenever you want two stacked finder windows in column view to move files with, just click on the Tandem script in your dock!

With this script installed, I am now in the habit of closing all finder windows whenever I don't need them and I just launch "tandem" via the dock whenever I need to use the finder.

I hope you find this as useful as I do.

Y
    •    
  • Currently 3.25 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[15,696 views]  

An AppleScript to create dual Finder windows | 14 comments | Create New Account
Click here to return to the 'An AppleScript to create dual Finder windows' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Left Side Dock
Authored by: tanhauser on Nov 27, '01 11:45:43AM

Nice an all but what do you do if your dock is on the LEFT side of the screen?



[ Reply to This | # ]
Left Side Dock
Authored by: Anonymous on Nov 27, '01 12:31:22PM

edit the following lines:

set the bounds of this_window to {0, (monitor_height * 0.7) div 1, monitor_width, monitor_height}

set the bounds of this_window to {0, (monitor_height * 0.04) div 1, monitor_width, (monitor_height * 0.68) div 1}

to:

set the bounds of this_window to {100, (monitor_height * 0.7) div 1, monitor_width, monitor_height}

set the bounds of this_window to {100, (monitor_height * 0.04) div 1, monitor_width, (monitor_height * 0.68) div 1}

or whatever value (in pixels) you want in place of 0

Y



[ Reply to This | # ]
This is rather fun!
Authored by: james_sorenson on Nov 27, '01 03:25:51PM

Nice piece of work! I gave it a hot-key using DragThing. I modified it to make space for (and activate) Drag Thing down the left-column and to close all existing Finder windows first. Now, with a press of a couple keys, DragThing comes forward, and my top window spans across and goes to my Home folder. Since I'm using the hack that removes the preview panel, my bottom window goes to my Temporary directory and leaves space for the Get Info window. The Get Info window moves to the bottom-right.

Ahhhhh...my screen is filled with DragThing, two Finder Windows, the Get Info Window, and the Dock. I've wasted too much time playing with this script, but your script was an inspiration. Thanks!



[ Reply to This | # ]
This is rather fun!
Authored by: DragonsBane on Nov 27, '01 09:53:31PM

Care to share? Would love to see your revised script =)



[ Reply to This | # ]
This is rather fun!
Authored by: james_sorenson on Nov 28, '01 02:00:49PM

Okay, here is my revised script. I didn't compile it as an application, but just
assigned it a hot-key. Using the script menubar item is also rather nice.
Here it is:

--FinderInit.scpt
--This script activates DragThing, opens two finely positioned Finder Windows, and opens the Info Window

--True Monitor size
property monitor_width : 1152
property monitor_height : 870
--Thicknes of titlebars (to prevent overlapping)
property menubar : 23
--Margins to make room for DragThing, Dock, Desktop items, etc
property leftmargin : 138
property rightmargin : 0
property topmargin : 0
property bottommargin : 54
--Height and width of the Info Window (will be placed to the right of the bottom window)
property infowidth : 280
property infoheight : 335


--Bring DragThing to the front (delete if you don't have it)
tell application "DragThing"
activate
end tell


tell application "Finder"
--set default directory (Notice that "home" represents your home directory)
set folder1 to home
--This is how you can refer to a subdirectory in your Home directory
set folder2 to ((home as string) & "Documents") as alias
--Use this if you'd prefer your bottom folder to go to root
--set folder2 to the startup disk

--clean up
activate
close every Finder window

-- BOTTOM WINDOW
set bot_window to make new Finder window
set the target of bot_window to folder2
--monitor origin is upper-left corner
--{left,top,right,bottom}
set the bounds of bot_window to {leftmargin, (monitor_height - infoheight - bottommargin),
(monitor_width - rightmargin - infowidth), (monitor_height - bottommargin)}
set the current view of bot_window to column view

-- TOP WINDOW
set top_window to make new Finder window
set the target of top_window to folder1
--monitor origin is upper-left corner
--{left,top,right,bottom}
set the bounds of top_window to {leftmargin, topmargin + (menubar * 2),
(monitor_width - rightmargin), (monitor_height - infoheight - bottommargin - menubar)}
set the current view of top_window to column view

-- INFO WINDOW
--Applescript currently can't set the position or bounds of the Info Window.
--Just move it to where you want it, close it, then open it. From then on, it will open in the proper place.
open information window of folder1
--set info_window to the information window
--set the position of info_window to {(monitor_width - rightmargin - infowidth), (monitor_height - infoheight - bottommargin)}

--Reactivate TOP WINDOW
select top_window
end tell



[ Reply to This | # ]
This is rather fun!
Authored by: Anonymous on Nov 28, '01 11:37:44PM

Great script!

Have you figured out how to tell the inspector to go to preview mode?

Your margin system is excellent.

I'm using a variation of your script now.

Cheers,

Y



[ Reply to This | # ]
Left Side Dock
Authored by: chadders on Nov 28, '01 03:12:03AM
set the bounds of this_window to {100, (monitor_height * 0.7) div 1, monitor_width, monitor_height}

set the bounds of this_window to {100, (monitor_height * 0.04) div 1, monitor_width, (monitor_height * 0.68) div 1}


Could someone please talk through these lines of the script that obviously position the windows on the screen, but which bits affect which elements of a window?

I think I've got most of it, but I am not sure about the * 0.7 type bits?

[ Reply to This | # ]
New easier script
Authored by: Anonymous on Nov 28, '01 09:15:24PM

This one just uses pixel numbers and is optimized for a 1024x768 screen with the dock at the bottom.

I have replaced the variables and functions to calculate window bounds with pixel values.

The bounds appear to be an array of the following values:

(left edge at # of pixels from left, top edge at # of pixels from top, right edge at # of pixels from left, bottom edge at # of pixels from bottom)

where the titlebar of the window is ignored.

Just change these numbers to change the window placement. Experiment for yourself until you get it the way you like it.

Cheers,

Y
___________________

set the startup_disk to (path to startup disk)

tell application "Finder"
activate
set visible of (every process whose visible is true and frontmost is false) to false
-- BOTTOM WINDOW
set this_window to make new Finder window
set the target of this_window to the startup_disk
set the bounds of this_window to {0, 400, 1024, 700}
set the current view of this_window to column view
-- TOP WINDOW
set this_window to make new Finder window
set the target of this_window to the startup_disk
set the bounds of this_window to {0, 46, 1024, 375}
set the current view of this_window to column view
end tell



[ Reply to This | # ]
New easier script
Authored by: chadders on Nov 29, '01 03:30:46AM

Thanks for the modified script... I can follow that logic! I am interested in what the other script was actually doing however... if you can spare the time a brief explanation would probably help me understand it better. Your modified script is working great on my system here, and I like it's functionality a great deal. Excellent, thank you.



[ Reply to This | # ]
New easier script
Authored by: james_sorenson on Nov 29, '01 02:10:16PM
Alas, although the Finder dictionary shows the syntax to change the
inspector panel, it refuses to do so. According to the dictionary,
the syntax would be:

set the current panel of the information window to Preview panel

But, it says:

"Can't set <<class panl>> of <<class iwnd>> to <<consant ipnlvpnl>>."

Oh well, I guess it hasn't been implemented yet.

[ Reply to This | # ]
great
Authored by: bhines on Nov 28, '01 04:52:51AM

This is beautiful at 1280x1024 on my 17" LCD.. .Ahh... I can't believe folks still use Windoze. This is the greatest OS.



[ Reply to This | # ]
Side-by-side windows script
Authored by: bkperry on Dec 01, '01 10:39:20AM

Hey, excellent script. I made some changes to have two windows open side-by-side. Here 's the script:

property monitor_width : 980
property monitor_height : 768

set the startup_disk to (path to startup disk)

tell application "Finder"
activate
set visible of (every process whose visible is true and frontmost is false) to false
-- BOTTOM WINDOW
set this_window to make new Finder window
set the target of this_window to the startup_disk
set the bounds of this_window to {60, 100, (monitor_width div 2), (monitor_height div 1.25)}
set the current view of this_window to column view
-- BOTTOM WINDOW
set this_window to make new Finder window
set the target of this_window to the startup_disk
set the bounds of this_window to {500, 100, (monitor_width div 1.03), (monitor_height div 1.25)}
set the current view of this_window to column view
end tell

BTW, a good program (cheap and powerful) to run timed applescripts is Alarm Clock SE. http://www.versiontracker.com/moreinfo.fcgi?id=12255&db=mac

Ciao!
---bkperry



[ Reply to This | # ]
some more mods....
Authored by: loren_ryter on Dec 23, '01 07:42:11PM

great idea... i changed the script slightly too so you can adjust the offsets (make space for iTunes, etc). paste a nice icon onto it!

Anyone know how to bring both windows to the front but NOT hide all other apps?

--begin--

property monitor_width : 975
property monitor_height : 700
property vOffset_top : 70
property vOffset_bottom : 10
property hOffset_top : 5
property hOffset_bottom : 5

set the startup_disk to (path to startup disk)
tell application "Finder"
activate
set visible of (every process whose visible is true and frontmost is false) to false
-- BOTTOM WINDOW
set this_window to make new Finder window
set the target of this_window to the startup_disk
set the bounds of this_window to {0 + hOffset_bottom, ((monitor_height * 0.55) div 1 + vOffset_bottom),
monitor_width, monitor_height}
set the current view of this_window to column view
--select this_window ; how can you bring to front?
-- TOP WINDOW
set this_window to make new Finder window
set the target of this_window to the startup_disk
set the bounds of this_window to {0 + hOffset_top, ((monitor_height * 0.06) div 1) + vOffset_top,
monitor_width, (monitor_height * 0.53) div 1}
set the current view of this_window to column view
--select this_window
end tell



[ Reply to This | # ]
2Wind: applet with nice icon
Authored by: loren_ryter on Dec 25, '01 06:23:43PM

With Yuriwho's permission, I've revised this script, compiled it, added a cool icon (for use in toolbar or dock)* and posted it on my site:

<http://beam.to/woodenbrain>

It is built on James Sorenson's version, which allows for an info window and opening DragThing.

It has been substantially re-written, tho, to allow for very easy customization in the properties section of the script. It can be saved as an applet or a compiled script. See script & read me for details.

* icon taken from unknown source; please contact if it is yours & you want credit.





[ Reply to This | # ]