In Finder, if you right click a file → Get Info, you will see a checkbox in the Name & Extension section that offers users the ability to Hide extension.

If you press Command (⌘)-Shift-3 to take a whole-screen screenshot on your Mac, a screenshot is saved as a .png file. By default, the .png extension for a screenshot is hidden.

Can I change this hide extension status using AppleScript?

If you are curious as to why I'm trying to perform this action in AppleScript, it is because I have a script that involves taking & saving a screenshot, and then naming the file based on the text on the clipboard. And, in this process of renaming the file, Finder no longer recognizes the file as a .png file, so I have to manually change the filename.

1 Answer 1


Never mind! I found the answer here:

Super User: Show/hide extension of a file through OS X command line

I will delete this question now!


Since some are upvoting this question, I will echo the top answer in the linked question (supplied by @slhck).

A straightforward solution exists, because AppleScript specifically offers a set extension hidden command designed to do exactly what I'm looking for.

tell application "Finder"
    set some_file to (choose file)
    set extension hidden of some_file to false
end tell

And that will make the file extension visible!

  • 2
    Rather than delete - maybe explain the script here and keep the link to the other answer?
    – bmike
    Commented Aug 9, 2016 at 2:03
  • Are you sure? I know how strongly SE frowns upon redundancy, and the question linked is practically identical to mine. Commented Aug 9, 2016 at 2:06
  • @rubik'ssphere Well... Um... True... (Problem with when site topics overlap each other.)
    – Bradman175
    Commented Aug 9, 2016 at 2:34
  • Note: It is necessary to insert file before the file path when one is not using (choose file) to get the file. Source: AppleScript: How to un-hide the file extension of a screenshot? Commented Feb 3, 2017 at 19:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .