Friday, July 19, 2013

AppleScript, the Finder, Mac OS 10.8, and "get selection"

Regular readers, skip this one -- only Googlers with very specific problems are going to be interested in this one...

I use Keyboard Maestro often in conjunction with AppleScripts to make my life easier. One of my favorites is the keystroke <cmd-b> to open files with BBEdit.

Under 10.8, AppleScript and the Finder are ridiculously slow -- "get selection" takes about 5 seconds per item selected to return a list of items selected.

The solution? Change it to "get selection as alias list". That returns the list instantaneously, and seems to work about the same in most cases.

Here's the script if you're curious (view on blogger, not feedly, to see the script correctly):

tell application "Finder"
set theApp to application file id "R*ch"
set theFiles to (get selection as alias list)
if (count of theFiles) > 0 then
open theFiles using theApp
else
open theApp
end if

end tell



Enjoy.

Does anyone read this thing?

views since Feb. 9, 2008