I’ve searched here at MacScripter and Googled, but found nothing. So here’s what I’m looking to do. I’d like to create a script that creates two Finder windows, both 576 x 810 and puts them side by side on the screen.
So far, I have a script that measures the Finder window (which is where the 576 x 810 came from). That script is below.
Any help would be appreciated.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "System Events"
set appOfInterest to "Finder" --set to desired application
set windowXY to size of the first window of application process appOfInterest
display notification (item 1 of windowXY as text) & " x " & (item 2 of windowXY as text) with title "Frontmost window of " & appOfInterest & ":"
end tell
Got it, and it works perfectly, posted below.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "Finder" to make new Finder window
tell application "System Events" to tell process "Finder"
set position of window 1 to {1, 25}
set size of window 1 to {576, 810}
end tell
tell application "Finder" to make new Finder window
tell application "System Events" to tell process "Finder"
set position of window 1 to {580, 25}
set size of window 1 to {576, 810}
end tell
set {hor, ver} to {1, 25}
tell application "Finder"
repeat 2 times
set myWin to make new Finder window
set bounds of myWin to {hor, ver, hor + 576, ver + 810}
set hor to 580
end repeat
end tell
Robert, I first spent some time just trying to understand how yours would work, and in fact it works perfectly, with the exact same two window placements as the one I came up with.
Now I’m working on a way to have both windows come up with the location “Documents” selected, either my script or your script.
set myDocs to path to documents folder as text
set {hor, ver} to {1, 25}
tell application "Finder"
repeat 2 times
set myWin to make new Finder window to folder myDocs
set bounds of myWin to {hor, ver, hor + 576, ver + 810}
set hor to 580
end repeat
end tell
Here is a newer slightly modified version
set myDocs to path to documents folder as text
set {hor, ver} to {1, 25}
tell application "Finder"
repeat 2 times
tell (make new Finder window to folder myDocs) to set bounds to {hor, ver, hor + 576, ver + 810}
set hor to hor + 579
end repeat
end tell
Thank you. And, I think I’ll end up using your script instead of mine, as I can not figure out how to add the “Documents” location to mine, at least not yet. Work in progress as I continue to learn to script.