Automator script to set/clear Show icon preview
I needed to change Finder's Show icon preview setting for a large number of folders containing image files. Fortunately, the Automator application is available to automate such repetitive tasks.
Below is a set of Automator actions to toggle the Show icon preview setting. The workflow can be used to create an Automator application, or a quick action.
- Pie Lover
Complete Workflow
Action Details
Select the parent image folder
on run {input, parameters}
if input is {} then -- nothing dropped
return (choose folder with prompt "Select the parent image folder" default location alias (path to pictures folder))
else
if (count of items in input) = 1 then
tell application "System Events"
set theFolder to path of (item 1 of input)
end tell
else
error "Can only process a single folder"
end if
return alias (theFolder)
end if
end run
Toggle the icon preview setting for the parent folder (or a single folder)
on run {input, parameters}
repeat with thisFolder in input
tell application "Finder"
open thisFolder
if (current view of front Finder window) is icon view then
set (shows icon preview of icon view options of front Finder window) to (not shows icon preview of icon view options of front Finder window)
else if (current view of front Finder window) is list view or (current view of front Finder window) is flow view then
set (shows icon preview of list view options of front Finder window) to (not shows icon preview of list view options of front Finder window)
else if (current view of front Finder window) is column view then
set (shows icon preview of column view options of front Finder window) to (not shows icon preview of column view options of front Finder window)
if (shows icon preview of column view options of front Finder window) then set (shows icon of column view options of front Finder window) to true
end if
close front Finder window
end tell
end repeat
return input
end run
Get the folder contents including subfolders
Select the subfolders only
Toggle the icon preview setting for each subfolder
on run {input, parameters}
repeat with thisFolder in input
tell application "Finder"
open thisFolder
if (current view of front Finder window) is icon view then
set (shows icon preview of icon view options of front Finder window) to (not shows icon preview of icon view options of front Finder window)
else if (current view of front Finder window) is list view or (current view of front Finder window) is flow view then
set (shows icon preview of list view options of front Finder window) to (not shows icon preview of list view options of front Finder window)
else if (current view of front Finder window) is column view then
set (shows icon preview of column view options of front Finder window) to (not shows icon preview of column view options of front Finder window)
if (shows icon preview of column view options of front Finder window) then set (shows icon of column view options of front Finder window) to true
end if
close front Finder window
end tell
end repeat
return true
end run
Mac mini (M2, 2023)