Skip to content

Instantly share code, notes, and snippets.

@n8henrie
Created August 2, 2014 16:44
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n8henrie/0ceef75964bd153f910d to your computer and use it in GitHub Desktop.
Save n8henrie/0ceef75964bd153f910d to your computer and use it in GitHub Desktop.
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