How to Access Path of Open File – Step-by-Step Guide

path

I have a file open in, say, a pdf viewer (or some other application). I want to get the path of the open file as text.

A simple approach to know the files location is to chose "Save As" – the dialogue comes up with the files current location selected.
For pasting a path into such a dialogue, I can do cmd-shift-G, but the text box that appears contains the most recent path used this way (not the current files path).

Is there a way to access the path (as text) of a file open in an application?

Best Answer

You can create small Apple Script and save it as an app.

on open {dropped_item}
    tell application "Finder" to set the clipboard to the POSIX path of the dropped_item
end open

Place this app on the Dock (easier to use). Then inside your pdf viewer you have small file icon on the top title bar -> drag it on top of the newly created app. With this, file path will be copied to the pasteboard.

enter image description here