-- Standardize Windows -- https://c-command.com/scripts/finder/standardize-windows -- Summary: Creates two Finder windows with standard positions and view options. -- Requires: Accessibility privileges to get the Dock’s size. -- Install Location: ~/Library/Scripts/Applications/Finder/ -- Last Modified: 2019-05-24 property pWindowWidth : 975 property pWindowHeight : 440 property pWindowChromeHeight : 23 property pDockPadding : 1 on run tell application "Finder" close every window my positionWindow(my makeWindow("/Users/mjt/"), 2) my positionWindow(my makeWindow("/Users/mjt/Downloads/"), 1) end tell end run on makeWindow(_path) set _file to POSIX file _path tell application "Finder" set _window to make new Finder window set _container to container _file set _window's target to _container set _window's bounds to {0, 0, pWindowWidth, pWindowHeight} set _window's current view to column view set _window's toolbar visible to true set _window's sidebar width to 160 set _window's statusbar visible to true set _window's statusbar visible to false set _window's statusbar visible to true return _window end tell end makeWindow on positionWindow(_window, _levelFromBottom) tell application "Finder" set {_left, _top, _right, _bottom} to bounds of desktop's window set _x to _right - pWindowWidth - pDockPadding - (my dockWidth()) set _fullWindowHeight to pWindowHeight + pWindowChromeHeight set _y to _bottom - _fullWindowHeight * _levelFromBottom + pWindowChromeHeight if (system attribute "sys2") ≥ 11 then -- In El Capitan, Finder now counts title bar in window size set _fullWindowHeight to _fullWindowHeight - pWindowChromeHeight set _y to _y + (_levelFromBottom - 1) * pWindowChromeHeight end if set _window's position to {_x, _y} end tell end positionWindow on dockWidth() tell application "System Events" tell application process "Dock" set {_width, _height} to size of list 1 return _width end tell end tell end dockWidth