I cobbled together a script that sets the view of the current selected Finder window:
tell application "Finder"
activate
tell icon view options of the front Finder window
set arrangement to arranged by name
set icon size to 64
set shows item info to true
set shows icon preview to true
end tell
tell the front Finder window
set toolbar visible to true
set current view to icon view
set the sidebar width to 160
end tell
end tell
I’d like it run on all sub folders of the current window if possible to set the view (icon size, arranged by etc.)
I did Google it but was looking for a general AppleScript to run on sub folders (not one that specifically for changing views). This looks just what I need, thanks!
I got the script (linked to previously) to work how I wanted, but it’s a droplet saved as an app. What I’d like to do is run it as a ‘regular’ script which I’d activate from Alfred or Keyboard Maestro to work on the current selected Finder window and all of it’s sub folders. How would I do this?
Here’s my adapted version of the script:
property counter : 0
on open theFolders
tell application "Finder"
tell the front Finder window
set toolbar visible to true
set the sidebar width to 160
end tell
end tell
set t to (current date)
set counter to (count theFolders)
tell application "Finder" to activate
-- Do the business with each dropped folder
repeat with thisFolder in theFolders
setViews(thisFolder)
end repeat
set t1 to (current date) - t
tell application "Finder" to display dialog (t1 as string) & " seconds for " & counter & " folders." with icon note
end open
on setViews(thisFolder)
tell application "Finder"
tell (get thisFolder's window)
set its current view to icon view
tell its icon view options
set arrangement to arranged by name
set icon size to 64
set shows item info to true
set shows icon preview to true
end tell
end tell
try
set theSubfolders to every folder of thisFolder as alias list
on error
set theSubfolders to first folder of thisFolder as alias as list
end try
end tell
set subfolderCount to (count theSubfolders)
if subfolderCount > 0 then
set counter to counter + subfolderCount
repeat with i from 1 to subfolderCount
setViews(item i of theSubfolders)
end repeat
end if
end setViews
Also, what is the first line of the script for? (property counter : 0)