Select files in Finder

Hey Jimmy,

I've been doing that for almost 2 decades with AppleScript, an osax that groks regex, and a utility that runs scripts.

THIS MACRO REQUIRES INSTALLATION OF THE SATIMAGE.OSAX (APPLESCRIPT EXTENSION).

Files { Select in Front Window } { KM Version }.kmmacros (7.6 KB)

————————————————————————————————————————————————————————————
Prefix	Example			Notes
————————————————————————————————————————————————————————————
None	any text		Any name containing your literal text is returned.
/	/j\..+tolkien		RegEx looks for your pattern anywhere in file name.
e/	e/.*j\..+tolkien.+	e/ is a mnemonic for exact (allows fancy patterns).
s/fi	None			Selects all files — s/ is a mnemonic for select.
s/fo	None			Selects all folders.
s/im	None			Selects all images.
suf/	suf/jpg			Selects by suffix
————————————————————————————————————————————————————————————

The script should be easily adapted to JXA. (Yosemite-only)

I did at one time adapt this to use Keyboard Maestro's regex, but due to the very slight pauses between actions it turned out to be slower than the AppleScript ( and I don't like to wait :).

The macro is very fast, but due to the way the Finder works it slows down as the number of files in a folder increase. So selection in a folder with a thousand files will be much slower than in a folder with 500 hundred files.

Selection on my system (mid-2010 i7 MacBook Pro) in a folder of 500 files is less than 2 seconds, and with fewer files it gets close to instant.

-Chris

2 Likes