How can I clear the selection of a Finder item. I just updated to Mavericks from Snow Leopard and in Snow Leopard if you pressed esc, it would clear the current selection. Like this:

tell application "System Events" to key code 53

How is this done in Mavericks?

有帮助吗?

解决方案

The way to do it in pure Applescript would be:

tell application "Finder"
    set selection to {}
end

其他提示

Ah, found it.

Hold Option and select "Deselect All" from Finder's "Edit" menu. Alternatively just use the shortcut Option+Cmd+A.

So as AppleScript:

tell application "System Events" to keystroke "a" using {command down, option down}

source: http://www.codez4mac.com/forum/viewtopic.php?f=212&t=72255

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top