Take the 2-minute tour ×
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).

Thanks!

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted
tell application (path to frontmost application as text)
    set p to path of document 1
end tell

tell application "Finder"
    reopen
    activate
    set selection to {}
    set target of window 1 to POSIX file p
end tell
share|improve this answer
add comment

Your Answer

 
discard

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.