Just an example of setting Finder Window List-View attributes that includes manipulating check-boxes and pop-up-buttons.
-------------------------------------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2015/10/01 13:04
# dMod: 2016/03/26 11:20
# Appl: System Events
# Task: Set List View Attributes of a Finder Window
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @System_Events, @Set, @List-View, @Attributes
-------------------------------------------------------------------------------------------
tell application "Finder"
tell front Finder window
if its current view ≠ list view then
set its current view to list view
delay 0.1
end if
end tell
end tell
tell application "System Events"
tell application process "Finder"
set frontmost to true
keystroke "j" using command down
set theClock to 0
repeat while front window's subrole is not "AXSystemFloatingWindow"
if theClock ≥ 0.5 then
beep
error "Problem opening window list-view prefs!"
else
set theClock to theClock + 0.1
delay 0.1
end if
end repeat
tell (first window whose subrole is "AXSystemFloatingWindow")
tell checkbox "Always open in list view"
if its value = 0 then
click it
end if
end tell
tell checkbox "Browse in list view"
if its value = 0 then
click it
end if
end tell
tell (first pop up button whose name is "Arrange By:")
if value ≠ "None" then
click
tell menu 1
click menu item "None"
end tell
end if
end tell
tell (first pop up button whose name is "Sort By:")
if value ≠ "Name" then
click
tell menu 1
click menu item "Name"
end tell
end if
end tell
tell group 1
tell checkbox "Date Modified"
if its value = 1 then
click it
end if
end tell
tell checkbox "Date Created"
if its value = 0 then
click it
end if
end tell
tell checkbox "Date Last Opened"
if its value = 1 then
click it
end if
end tell
tell checkbox "Date Added"
if its value = 1 then
click it
end if
end tell
tell checkbox "Size"
if its value = 1 then
click it
end if
end tell
tell checkbox "Kind"
if its value = 1 then
click it
end if
end tell
tell checkbox "Version"
if its value = 1 then
click it
end if
end tell
tell checkbox "Comments"
if its value = 1 then
click it
end if
end tell
tell checkbox "Tags"
if its value = 1 then
click it
end if
end tell
tell checkbox "Use relative dates"
if its value = 0 then
click it
end if
end tell
tell checkbox "Calculate all sizes"
if its value = 1 then
click it
end if
end tell
tell checkbox "Show icon preview"
if its value = 1 then
click it
end if
end tell
end tell
keystroke "j" using command down
end tell
end tell
end tell
-------------------------------------------------------------------------------------------