Smart Finder Tabs Launcher for macOS AppleScript

This AppleScript streamlines your Finder workspace by checking for an existing Finder window and reusing it to open specified folders as individual tabs, thereby avoiding duplicate windows or tabs. Customize the folders by editing the definitions at the top of the script.

The folder paths are defined near the beginning of the script. For example, you can customize the following lines to change which folders open:

set docsFolder to (path to documents folder)
set desktopFolder to (path to desktop folder)
set downloadsFolder to (path to downloads folder)


Simply modify these variables to point to your desired folder paths.

Click to view script…
-- Title: Finder Tabs Organizer
-- Description:
-- This AppleScript opens designated folders as tabs in Finder
-- Customize the folders to open by modifying the folder definitions below.

-- Handler to open a new tab for a given folder
on openNewTabWithFolder(theFolder)
    tell application "System Events"
        keystroke "t" using {command down} -- simulate Command+T to open a new tab
    end tell
    delay 0.5
    tell application "Finder"
        set target of front Finder window to theFolder
    end tell
end openNewTabWithFolder

-- Define the folders to open
set docsFolder to (path to documents folder)
set desktopFolder to (path to desktop folder)
set downloadsFolder to (path to downloads folder)

tell application "Finder"
    activate
    if (count of Finder windows) > 0 then
        -- Use the existing Finder window and set its target to Documents
        set target of front Finder window to docsFolder
    else
        -- No window exists, so open a new window for Documents
        open docsFolder
    end if
end tell

delay 0.5

-- Open additional tabs for the other folders.
openNewTabWithFolder(desktopFolder)
openNewTabWithFolder(downloadsFolder)