Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

For years I've been using this AppleScript to toggle the sort order of a Finder window:

if sort direction of column id size column of list view options of window 1 is normal then
    set sort direction of column id size column of list view options of window 1 to reversed
else
    set sort direction of column id size column of list view options of window 1 to normal
end if

(You can replace size with kind, name, modification date, etc.)

But ever since Lion, this no longer works!

The little arrow in the column header DOES change, but the items do not re-sort.

Any way to get this working?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

This is a bit hacky, but changing the sort column before and after changing the sort direction seemed to work on Mountain Lion.

tell application "Finder"
    tell list view options of window 1
        set sort column to name column
        tell column size column
            if sort direction is normal then
                set sort direction to reversed
            else
                set sort direction to normal
            end if
        end tell
        set sort column to size column
    end tell
end tell
share|improve this answer
    
ha! that works, thanks! silly. –  Ze'ev Aug 10 '12 at 22:24
    
And I didn't know you could nest the tell list view options ... excellent! –  Ze'ev Aug 10 '12 at 22:27
    
... and turns out you can nest the tell column size column as well: tell column size column ... if sort direction is normal then ... end tell –  Ze'ev Aug 10 '12 at 22:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.