hishboy
hishboy

Reputation: 339

How do I disable Preview Icon using objective-c

How do I disable the "Show icon preview" checkbox in Finder using objective-c (see screenshot). I want to disable it for specific folders, not system wide.

alt text

Upvotes: 2

Views: 701

Answers (1)

Georg Schölly
Georg Schölly

Reputation: 126115

You have to use AppleScript through NSAppleScript:

tell application "Finder"
    -- create a new finder window
    set newWindow to make new Finder window

    -- Alternatively you could use
    -- set target of newWindow to folder "Macintosh HD:SomeFolder"
    set target of newWindow to choose folder

    -- get the options of that new window
    set options to icon view options of newWindow

    -- disable preview
    set shows icon preview of options to false
    close newWindow
end tell

I believe this information is stored in the .DS_Store files, but still the only save way of modifying it is through the Finder.

Upvotes: 5

Related Questions