How to Hide the Extension of Selected Files in Finder

Similar to how I can lowercase all selected files in Finder from a hotkey which can be seen here.

I really wish there was a similar hotkey but for hiding the extension of all selected files. Essentially it should mark this checkbox for all files I selected in Finder.

This would be incredibly useful for me. Thank you for any help on this.

tell application "Finder"
  set finderSelection to the selection as alias list
  repeat with theItem in finderSelection
    set extension hidden of theItem to true
  end repeat
end tell

Edit:

Or via KM action, as I just found out :wink::

4 Likes

Thank you Tom.

For the KM macro, what do I have to pass to the ‘file’ attribute since /Users/tom… is fixed path. I will have multiple files.

The applescript works great though. Just curious about how will km macro work. :slight_smile:

Use the usual For Each action:

How do you enter the “wpath” variable? Its not on my list of variables. I assume it’s a special variable.

You can use any variable name. myNicePathVar or whatever.

Its not on my list of variables

A variable is created when it is used the first time.

PS:

There are special variables in KM, but only a few. Namely ENV_<…> (for example ENV_PATH), Result Button, and probably a few more.

Thanks, Tom. The special “w” threw me and made me think it was a special variable whose location I simply hadn’t found.

No, the ω is just my personal prefix for temporary variables, since it gets sorted at the end of the variables list (could also be zzz).