I am still at the very early stage of learning AppleScript and I working with Saghoian and Cheeseman’s Apple Pro Training Series: AppleScript 1-2-3.
I would like to change the icon size in Icon View and the book gives some sample code:
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 false
set shows icon preview to true
set text size to 12
set label position to bottom
set background color to {65535, 65535, 65535}
end tell
tell the front Finder window
set current view to icon view
end tell
end tell
However, changing the value of
set icon size to 64
to another number, such as 96 or 124 etc does not change the size of the icon.
I am using macOS 10.14.4.
I would be grateful to know whether I am doing something wrong or whether this command no longer functions in the current MacOS.
The script as written will change the icon size but the Finder window has to be closed and opened for the changes to take effect. Or, you can have the script do that.
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 false
set shows icon preview to true
set text size to 12
set label position to bottom
set background color to {65535, 65535, 65535}
end tell
tell the front Finder window
set current view to icon view
end tell
--Close and open the Finder to enable new settings.
set currentFolder to target of front Finder window
close front Finder window
open currentFolder
end tell
set theFolder to choose folder
tell application "Finder"
open theFolder
repeat until (exists Finder window 1)
delay 0.1
end repeat
tell Finder window 1 to if current view ≠ icon view then set current view to icon view
tell icon view options of Finder window 1
set arrangement to arranged by name
set icon size to 256
set shows item info to false
set shows icon preview to true
set text size to 12
set label position to bottom
set background color to {65535, 65535, 65535}
end tell
close Finder window 1
open theFolder
repeat until (exists Finder window 1)
delay 0.1
end repeat
activate
end tell