Mentioning selecting in Finder a few minutes ago reminded me of this script I slapped todether a few days ago. For the amusement of the list, here it is. #!Perl #-------------------------------------------------------------------------- # select_by_regexp.pl -- version 1 (1998-03-06) # Author: Sean M. Burke (sburke@netadventure.net) # # Description: select files in Finder by regexp # # Usage: # Drop onto me a file from the directory you want to # select items from, or drop the directory itself on me. # Then I'll select (in a Finder window) items from that # directory whose filenames watch a regexp you enter. # # Notes: # * I (or rather, Finder) can only work on one directory at a time. # * The regexp-matching is case-insensitive. # * It takes a second or two for it to work. (AppleScript == slow) # * If what you drop is an alias, it will (or may not?) resolve to # what it's an alias to, if you're using an old MacPerl # # For me to be droppable-on, you need to open me in MacPerl and save me # as a droplet. # #-------------------------------------------------------------------------- # Availability & Copying: # # select_by_regexp.pl is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by the # Free Software Foundation, version 2. # # select_by_regexp.pl is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # To see a copy of the GNU General Public License, see # http://www.ling.nwu.edu/~sburke/gnu_release.html, or write to the # Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. #-------------------------------------------------------------------------- # Rev notes: # 1998-03-06: Version 1 -- released. Whee. die "I need to be on a Mac\n" unless $MacPerl::Version; if(@ARGV == 0) { print "Usage: drop onto me a file from the directory you want to select items from, or drop the directory itself. Then I'll select (in a Finder window) items from that directory whose filenames watch a regexp you enter.\n\n"; exit; } exit unless @ARGV == 1; $base = $ARGV[0]; $base =~ s/\:[^\:]+$// if -f $base; die "$base does not exist" unless -e $base; $regexp = MacPerl::Ask('Regexp', ''); exit if $regexp eq ''; die "Can't opendir $base\n" unless opendir(BASE, $base); @files = grep(/$regexp/oi, readdir(BASE)); closedir(BASE); unless(@files) { print "No items in $base match $regexp\n\n"; exit; } print scalar(@files), " items in $base matched /$regexp/\n", map(" $base\:$_\n", @files), "\n\n"; &MacPerl::DoAppleScript( "tell application \"Finder \" activate open folder \"$base\" select { " . join(", ", map("item \"$_\" of window of folder \"$base\"", @files) ) . " \} end tell " ); exit; __END__ ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch