Glam Prestige Journal

Bright entertainment trends with youth appeal.

In a thread on this forum there is an interesting solution on how to open a duplicate of an already open Finder window with the help of an AppleScript:How do you duplicate current open Finder view?

With the new tabbed Finder in OS X 10.9 Mavericks, I am wondering if there is a way to implement an AppleScript that opens the duplicate in a new Finder tab instead of a new Finder window? Did anybody succeed in finding a solution?

5 Answers

You can do it by pressing:

cmd+ctrl+O

on any folder and it'll show up in a new tab.

2

Finder's dictionary doesn't have support for tabs, but you can simulate pressing command-T:

tell application "Finder" activate set t to target of Finder window 1 set toolbar visible of window 1 to true
end tell
tell application "System Events" keystroke "t" using command down
end tell
tell application "Finder" set target of Finder window 1 to t
end tell

The target of a Finder window is the folder shown on the title bar, which does not depend on what items are selected in list view.

3

I wrote a script for this today, pretty similar to how @Lri has done it.

-- duplicateFinderTab.scpt
-- Uses a hacky workaroud to duplicate the frontmost Finder tab,
-- since Apple hasn't provided great AppleScript support for this.
on new_tab() tell application "System Events" to tell application process "Finder" set frontmost to true tell front menu bar to tell menu "File" to tell menu item "New Tab" perform action "AXPress" end tell end tell
end new_tab
on run {} tell application "Finder" if (count of Finder windows) > 0 then set duplicate_me to target of front Finder window end tell -- Short delay may or may not be necessary, mine seems to work without. -- delay 0.2 new_tab() tell application "Finder" set target of front Finder window to duplicate_me end tell
end run

This is @n8henrie's solution, except with a tweak to reselect the selected items, which I kind of like:

-- duplicateFinderTab.scpt
-- Uses a hacky workaroud to duplicate the frontmost Finder tab,
-- since Apple hasn't provided great AppleScript support for this.
----------------------------------------------
on run {} tell application "Finder" if (count of Finder windows) > 0 then set duplicate_me to target of front Finder window set _sel to the selection end tell -- Short delay may or may not be necessary, mine seems to work without. -- delay 0.2 new_tab() tell application "Finder" set target of front Finder window to duplicate_me select _sel end tell
end run
----------------------------------------------
on new_tab() tell application "System Events" to tell application process "Finder" set frontmost to true tell front menu bar to tell menu "File" to tell menu item "New Tab" perform action "AXPress" end tell end tell
end new_tab

Click the finder tab you want to duplicate, then CMD+T.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy