In an earlier post, Hows does one come up with a useful script??? by knightjp, I suggest Julz write a script that would duplicate a window for easy manual transfer of files. Of course the reason I suggested it was because I was working on one myself. And I’ve got it working just the way I want it (code at the bottom). But I had some trouble with the ‘make new Finder window’ command. When I used either this
make new Finder window at front with properties {bounds:newWindowBounds, current view:origWindowCurrentView} to origWindowTarget
or this
make new Finder window at front to origWindowTarget with properties {bounds:newWindowBounds, current view:origWindowCurrentView}
the script would make the window, but would not implement the properties I wanted. I finally just used the three lines below and let it got at that.
make new Finder window at front to origWindowTarget
set bounds of window 1 to newWindowBounds
set current view of window 1 to origWindowCurrentView
The question of course is why aren’t the ‘with properties’ part of the command working?
duplicateCurrentFinderWindow()
to duplicateCurrentFinderWindow()
-- v1.00
-- Independent
tell application "Finder"
set desktopWinBounds to bounds of window of desktop
set yMax to item 4 of desktopWinBounds
set origWindowName to name of window 1
set origWindowBounds to bounds of window origWindowName
set yOrigPos to item 2 of origWindowBounds
set xNewPos to (item 1 of origWindowBounds) + 50
set yNewPos to 44
if yOrigPos ≤ (yMax div 3) then ¬
set yNewPos to yMax - (item 4 of origWindowBounds) + (item 2 of origWindowBounds)
set xNewEnd to (item 3 of origWindowBounds) - (item 1 of origWindowBounds) + xNewPos
set yNewEnd to (item 4 of origWindowBounds) - (item 2 of origWindowBounds) + yNewPos
set newWindowBounds to {xNewPos, yNewPos, xNewEnd, yNewEnd}
set origWindowTarget to target of window origWindowName
set origWindowCurrentView to current view of window origWindowName
make new Finder window at front to origWindowTarget
set bounds of window 1 to newWindowBounds
set current view of window 1 to origWindowCurrentView
end tell -- application "Finder"
end duplicateCurrentFinderWindow