Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed Afloat for Mac OS X and I really like that it has a shortcut to "Reveal Current File in Finder". This works for basically all applications written in Cocoa.

Can I use something like that, possibly applescript and the scripts menu, to get the path of the current open file, possibly in any application? I'd love to be able to set that to a shortcut key (I can manage that part).


share|improve this question
up vote 3 down vote accepted
tell application (path to frontmost application as text)
    set p to path of document 1
end tell

tell application "Finder"
    set selection to {}
    set target of window 1 to POSIX file p
end tell
share|improve this answer
I used a similar script and it did work but since all of a sudden I'm always getting missing value – any idea? – Julian F. Weinert Jan 20 '15 at 17:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.