MacOS – Shortcut go to folder containing the file opened in TextEdit

folderskeyboardmacosshortcuttextedit

I know that I could right click on the window title to have the folder path but the question is specifically to use a keyboard shortcut.

Maybe is there a way through the creation of an Automator service? Or AppleScript?

Any suggestions are accepted thanks 🙂

Best Answer

The solution was to use an AppleScript!

Here the code to insert in Automator (during the creation of a new service)

tell application "TextEdit"
    tell front document
        set apath to (its path) as text
        tell application "Finder" to open item (apath as POSIX file)'s container's container window
    end tell
end tell

tell application "Finder"
    activate
end tell


return

Automator window will look like this: enter image description here