Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Applescript to change List Views in the Finder

Does anyone have any idea why this Applescript does not hide the Date Modified column in a Finder window in 10.6.x. The Applescript editor does not complain about any syntax errors. It just blinks when it runs and nothing changes. (Note: The change to list view works fine I just can't get the Date Modified column to disappear.)


Thanks


tell application "Finder"


activate

tell the front Finder window

set the current view to list view

end tell


tell list view options of front Finder window

set visible of columnmodification date column to false

end tell

end tell

Posted on Nov 29, 2011 11:27 AM

Reply
6 replies

Nov 29, 2011 5:38 PM in response to jreasthope

In Mac OS X 10.7.2, the icon view options, list view options and column view options properties seem to be “read only” (not sure for OS X 10.6.x). However, it's possible to use GUI Scripting in order to hide the Date Modified column :


tell application "Finder"

activate

tell the front Finder window

set the current view to list view

end tell

tell application "System Events" to tell process "Finder"

if name of menu item -1 of menu 1 of menu bar item "View" of menu bar 1 is "Show View Options" then

keystroke "j" using {command down}

end if

tell checkbox "Date Modified" of group 1 of window 1

if value is 1 then click

end tell

keystroke "j" using {command down}

end tell

end tell


Message was edited by: Pierre L. (“end if” moved up)

Nov 30, 2011 7:44 AM in response to Pierre L.

Thanks Pierre,


I knew about GUI scripting but I was trying to to avoid using it as I need to adjust most of the properties in the list view options and GUI scripting is slower and a lot more cumbersome than the more direct Applescript commands that were available in 10.5.


I did find it odd that if you use the Record feature in AppleScript Editor it does come back with...


set visible of column id modification date column of list view options of Finder window 1 to false


Unfortunately it just doesn't work.


I will keep hunting for now but it's good to know I can use this as a last resort.


Thanks


John

Dec 1, 2011 7:42 AM in response to jreasthope

Well it looks like GUI scripting is the only way to go. For those that have stumbled across this during a search here is my final script which covers how to change or adjust all the aspects of a Finder window's List View Options. If you need help with this just reply to this message. (Note: Watch for line wrapping if you copy and paste.) - John


tell application "Finder"


activate

tell the front Finder window

set the current view to list view

set the toolbar visible to false

end tell


tell list view options of front Finder window

set properties to {sort column:name column, sort direction:normal, icon size:small icon, text size:12, uses relative dates:false, calculates folder sizes:true, shows icon preview:false}

set width of column name column to 250

end tell


tell application "System Events" to tell process "Finder"

tell menu item "Show View Options" of menu of menu bar item "View" of menu bar 1 to if exists then click

tell checkbox "Always open in icon view" of window 1 to if (exists) and value is 1 then click

tell checkbox "Always open in list view" of window 1 to if (exists) and value is 0 then click

tell checkbox "Date Modified" of group 1 of window 1 to if value is 1 then click

tell checkbox "Date Created" of group 1 of window 1 to if value is 1 then click

tell checkbox "Size" of group 1 of window 1 to if value is 0 then click

tell checkbox "Kind" of group 1 of window 1 to if value is 1 then click

tell checkbox "Version" of group 1 of window 1 to if value is 1 then click

tell checkbox "Comments" of group 1 of window 1 to if value is 1 then click

tell checkbox "Label" of group 1 of window 1 to if value is 1 then click


clickbutton 0 of window 1


clickmenu item "Zoom" of menu of menu bar item "Window" of menu bar 1

end tell

end tell

Feb 28, 2015 5:11 AM in response to jreasthope

Great script ! Tells me everything I need to know on this topic, except that I would like to be able to sort by the creation date column


I tried {sort column:date created column, sort direction:normal, etc but it would not compile:


'Expected “,” or “}” but found class name'


Could you suggest why this does not work on my computer ?


BTW: I am using Snow Leopard 10.6.8

Feb 28, 2015 5:24 AM in response to jreasthope

If you switch to list view in the Finder, and then right-click on the bold Date Modified header, you will see a pop-up list of items that can be selected, or deselected. Changing Date Modified to unselected will remove it. You can then grab the separator bar to the right of this new void in the list view, and drag it to the left to close up the formatting. Once you close this Finder window, the new formatting, without Date Modified, will be applied to future Finder window list views. No AppleScript, and in particular GUI AppleScripting necessary.

Applescript to change List Views in the Finder

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.