Last active
May 22, 2024 11:09
-
-
Save mehrshad-kh/85f9b504e0e7f49c9c8279cf2c06c579 to your computer and use it in GitHub Desktop.
An AppleScript that hides the extension of all images in a folder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use the first line for a Quick Action. | |
# on run {input, parameters} | |
on run | |
# Comment the following line for a Quick Action. | |
set input to choose folder with prompt "Please select a document to pcoess." with multiple selections allowed | |
tell application "Finder" | |
repeat with eachItem in input | |
# Recursively search through all subfolders. | |
if kind of eachItem is "Folder" then | |
set allFiles to (every file in entire contents of folder eachItem) | |
repeat with eachFile in allFiles | |
my hideExtension(eachFile) | |
end repeat | |
else | |
set eachFile to eachItem | |
my hideExtension(eachFile) | |
end if | |
end repeat | |
display dialog "Image extensions have been successfully hidden." | |
end tell | |
return | |
end run | |
on hideExtension(theFile) | |
tell application "Finder" | |
if extension hidden of theFile is false then | |
# Such as jpeg. | |
# set fileExtension to name extension of theFile | |
# Such as JPEG image. | |
set theKind to kind of theFile | |
if theKind ends with "image" then | |
set extension hidden of theFile to true | |
end if | |
end if | |
end tell | |
end hideExtension |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is an AppleScript that allows you to hide file extensions in Finder on macOS. It can be easily modified to suit your needs.
If you would like to use it as a Quick Action in Finder, simply create a Quick Action in Automator, and set it to run this AppleScript. You should only change two lines according to the comments. Afterwards, you can select files and folders in Finder as usual, right-click, and select your action from the Quick Actions menu.