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

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

1 Answer 1

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 Jan 20 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.