frontDocumentPath
Returns the file path of the document open in the front window.
Keyboard Maestro: FrontDocumentPath
Details #
frontDocumentPath() takes no arguments and returns the path of the document shown in the focused window of the front app, as text, or empty text when that window has no document.
Parameters #
Takes 0 arguments.
{{ frontDocumentPath() }}
Examples #
frontDocumentPath()→
Gotchas #
It needs the Accessibility permission. Without it the result is empty text.
Only apps that tell macOS which file a window shows (most document apps do) can answer.
Calling it with any argument is an error:
frontDocumentPath() takes 0 arguments, got 1.When no real Mac is behind it (tests, previews) or the Mac can't answer, it returns empty text.