Browse the docs

finderSelection

Returns the path of the one item selected in Finder.

Keyboard Maestro: FinderSelection

Details #

finderSelection() takes no arguments and returns the POSIX path of the selected item in Finder. When nothing is selected, or more than one item is, it returns empty text.

Parameters #

Takes 0 arguments. {{ finderSelection() }}

Examples #

finderSelection()
→

Gotchas #

  • Use finderSelections when more than one item may be selected.

  • It asks Finder through Automation, so Switchboard needs permission to control Finder. If that is denied it returns empty text.

  • Calling it with any argument is an error: finderSelection() takes 0 arguments, got 1.

  • When no real Mac is behind it (tests, previews) or the Mac can't answer, it returns empty text.