I was hoping that I would just be able to find a script that would do what I want or that I could easily modify. But I haven’t found it and I’m not much of a scripter so I don’t know where to begin.
All I want is a script that can open up a certain number of finder windows in specific places. That is, I double click on the script a a new window opens up in position A, another one in postion B, etc. I need to be able to modify it for differnt screen resoltions, number of finder windows, and the size of the windows. Can someone please give me a running start or perhaps point me to some documentation.
The first part is easy. You can take a look at Chapter 4 of Bill Briggs’s AppleScript Primer
The thing that’s different between X and 9 is that instead of sizing a window by using position and size, just use the new property ‘bounds’.
Open a window and run this script in Script Editor (select the “Results” button at the bottom of the Script Editor window):
tell application "Finder"
get properties of window 1
end tell
Look at the result in the bottom pane for the property ‘bounds’. It will be a list of the 4 corners’ pixel position.
That should get you started. Just open all of your windows and find the bounds of each.
Getting the resolution is a different matter. I’ll have to look into that…
Thanks for the info. I ran the get properties of windwo script and I now understand how OS X postions a window (using a starting origin and bounds). What would a script look like that would tell the finder to draw a window with a specific starting point and bounds?
I don’t necessarily need to have the script be aware of the screen resolution. For instance, making a script for a 1600x1200 screen and then one for a 1024x768 screen wouldn’t be too much of a chore.
tell application "Finder"
set new_window to make new Finder window to (path to home folder)
tell new_window
set toolbar visible to false
set current view to list view
set bounds to {100, 100, 400, 400}
tell its list view options
set calculates folder sizes to false
set icon size to small
set sort column to modification date column
set uses relative dates to false
end tell
set zoomed to true
return properties
end tell
end tell
This did indeed get me going. Thank you. I can now run a script that will make one window in the exact postion I want. My problem now is that I don’t know how to make a second window (or third, etc.) I thought I could just copy and paste the center portion of the script to make another window. But this doesn’t work.
tell application "Finder"
set new_window to make new Finder window to (path to home folder)
tell new_window
set toolbar visible to false
set current view to list view
set position to {100, 100}
set bounds to {100, 100, 400, 400}
tell its list view options
set calculates folder sizes to false
set icon size to small
set sort column to modification date column
set uses relative dates to false
end tell
set zoomed to true
return properties
tell application "Finder"
set new_window to make new Finder window to (path to home folder)
tell new_window
set toolbar visible to false
set current view to list view
set position to {100, 100}
set bounds to {100, 100, 400, 400}
tell its list view options
set calculates folder sizes to false
set icon size to small
set sort column to modification date column
set uses relative dates to false
end tell
set zoomed to true
return properties
end tell
end tell
I always get a “Sytax Error Expected end of line, etc. but found end of script.” I’ve tried elimination/repositioning the “end of tell” command in various locations. But ulitmately I’m just guessing and I don’t know what I’m doing.
I actually looked at Finder Window Manager, but it’s a little much for my needs. I just need 4 (or 5) windows to always pop up in the same place. Finder Window Manager will do that, but it also does a whole lot more.
There are a lot of things wrong with your script. First, you only need one tell to the Finder, next, the “return” calls stop the script in its tracks, and most of what you want to do can be accomplished by iterating through lists:
set the_bounds to {{100, 100, 400, 400}, {150, 150, 450, 450}, {200, 200, 500, 500}}
set the_paths to {path to home folder, path to desktop folder, path to library folder from user domain}
tell application "Finder"
repeat with i from 1 to (count the_bounds)
set new_window to make new Finder window to (item i of the_paths)
tell new_window
set toolbar visible to false
set current view to list view
set bounds to (item i of the_bounds)
tell its list view options
set calculates folder sizes to false
set icon size to small
set sort column to modification date column
set uses relative dates to false
end tell
end tell
end repeat
end tell
tell application “Finder”
activate
set the_views to {icon view, list view, column view}
set w to (make new Finder window at front)
repeat with this_view in the_views
set current view of w to this_view
delay 2
end repeat
close front window
end tell
Yes, as kel points out, you can do this, but it when using the terms “icon view”, “list view”, “column view”, these are terms defined by the Finder’s AppleScript dictionary so if you use them outside of a Finder tell block, (or a using terms from application “Finder” block) AppleScript doesn’t know what they are and won’t let you use them.