Skip to content

Instantly share code, notes, and snippets.

@aerobounce
Last active April 9, 2020 07:07
Show Gist options
  • Save aerobounce/a3976b3cf51548a4fd46b84d2d5137bb to your computer and use it in GitHub Desktop.
Save aerobounce/a3976b3cf51548a4fd46b84d2d5137bb to your computer and use it in GitHub Desktop.
How to get Finder's selection path in alias form, in AppleScript and JXA.

AppleScript

tell application "Finder"
    set itemList to (selection as alias list)
end tell

JXA

const Finder = Application("Finder")
const SystemEvents = Application("System Events")
const itemList = Finder.selection().map(e => SystemEvents.aliases[decodeURIComponent(e.url().substring(7))]())
@aerobounce
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment