Change Finder window text size via AppleScript or shell

applescriptfinder

I would like to create shortcuts to "zoom" my Finder window text size.

I have tried in AppleScript

tell application "Finder"
    if text size of list view options of front window = 10 then
        set text size of list view options of front window to 16
    else
        set text size of list view options of front window to 10
    end if
end tell

which works but I cannot see the change until I "refresh" the window by closing and re-opening it.

I tried adding

update items of front window

but this does nothing.

Any way to do this elegantly?

I'm on El Capitan.

Best Answer

  • Ze'ev, amigo:

    This sounds like a job for the shell, and we might get you the functionality you desire in possibly two ways.

    First, let's try the elegant method: Without closing any windows, send a SIGHUP to the Finder process, shell-side, after you change that parameter in the AppleScript. Specifically, add the line:

    do shell script "pkill -1 -l Finder"
    

    The second argument to pkill -- the '-l' -- is for debugging purposes. If this works, remove the '-l'.

    On a side-note, the font size change is also something that can be changed from the shell-side, via the 'defaults' command.

    Please let me know if that works out for you.

    Best of luck,

    F.