Create a gist now

Instantly share code, notes, and snippets.

Uses a hacky workaroud to duplicate the frontmost Finder tab, since Apple hasn't provided great AppleScript support for this.
-- duplicateFinderTab.scpt
-- Uses a hacky workaroud to duplicate the frontmost Finder tab,
-- since Apple hasn't provided great AppleScript support for this.
-- Details at:
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
delay 0.5
new_tab()
tell application "Finder"
set target of front Finder window to duplicate_me
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment