You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Help with Finder window spawn script

trying to tweak this script to do something very simple: open two adjacent finder windows on my laptop screen EVEN IF my external display serves as the "Main display," any help much appreciated:


tell application "Finder"

activate

-- Set the screen dimensions for your laptop display

set screenWidth to 1440

set screenHeight to 932

-- Calculate window dimensions to fit side by side

set windowWidth to (screenWidth * 0.45) as integer -- 45% of screen width

set windowHeight to (screenHeight * 0.8) as integer -- 80% of screen height

-- Calculate positions to place the windows adjacent to each other on the laptop screen

set leftWindowX to ((screenWidth - (2 * windowWidth)) / 3) as integer -- Centered with equal margins

set rightWindowX to (leftWindowX + windowWidth + (screenWidth - (2 * windowWidth)) / 3) as integer -- Directly adjacent to the left window

set windowY to ((screenHeight - windowHeight) / 2) as integer -- Centered vertically

-- Get all Finder windows

set allWindows to every Finder window

-- Ensure we have at least two windows

if (count of allWindows) < 2 then

-- If there aren't two windows, create them

repeat (2 - (count of allWindows)) times

make new Finder window

delay 0.5 -- Wait for the window to open

end repeat

set allWindows to every Finder window

end if

-- Position the first two windows on the laptop display

set bounds of item 1 of allWindows to {leftWindowX, windowY, leftWindowX + windowWidth, windowY + windowHeight}

set bounds of item 2 of allWindows to {rightWindowX, windowY, rightWindowX + windowWidth, windowY + windowHeight}

-- Set the view to columns

set current view of Finder window 1 to column view

set current view of Finder window 2 to column view

end tell



[Re-Titled by Moderator]



Posted on Nov 25, 2024 9:31 AM

Reply

There are no replies.

Help with Finder window spawn script

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.