For ages now toggling the visibility of columns in the list view of Finder windows is not working in an AS script.
This for instance, keeps failing:
tell application "Finder"
set _win to Finder window 1
tell _win
tell list view options of _win
tell column size column of list view options of _win
set properties to {index:4, name:size column, visible:false}
end tell
end tell
end tell
end tell
I have not found any explanation as to why Apple doesn’t seem to have any intention to fix this. Any idea anybody?
Way back in 10.6 I have found this GUI script that worked trough 10.7 and maybe 10.8:
tell application "Finder"
activate
tell fwin
select -- # added to bring fwin to front
set current view to list view
end tell
end tell
tell application "System Events"
tell process "Finder"
set view_options to a reference to (window 1 whose subrole = "AXSystemFloatingWindow")
set was_open to exists view_options
if not was_open then
tell menu bar 1's menu bar item 5 -- View
tell menu 1's menu item -1 -- Show View Options
click
end tell
end tell
end if
tell view_options
tell group 1
-- The checkbox was 4 for Label in 10.6.
-- I'm trying 9 for Tags in 10.11 but the click fails.
tell checkbox 9
if value = 0 then click
click
(*
-- error number -1719 from window 1 of process "Finder" ¬
whose subrole = "AXSystemFloatingWindow"
-- Result: error ¬
"System Events got an error: Can't get window 1 of process \"Finder\" ¬
whose subrole = \"AXSystemFloatingWindow\". Invalid index." number -1719
*)
end tell
end tell
if not was_open then click (button 1 whose subrole = "AXCloseButton") -- Close
end tell
end tell
end tell
end show_label_in_list_view
I’m trying again now in 10.11 to manipulate column visibility in list view, but found nothing that works.
Please, can anybody help with a scripted solution for adding and/or removing columns in list view?
Maybe using ASObjC?