AppleScript

For some reason I prefer to have system files (hidden by default) shown in Finder (must be the Unix in my system from grad school). With that said, there are times when it would be nice to have these same files out of sight when working with a cluttered folder. After having thought many times about writing a short script to toggle hidden files on/off, I finally took a few minutes to crank out the code below:

Script Editor Click to paste code into the Script Editor

----------------------------------------
--  MacDeveloperTips.com
--  Toggle Finder hidden file status
----------------------------------------
try
  -- Get current value
  set toggle to do shell script "defaults read com.apple.finder AppleShowAllFiles"

  -- Toggle it
  if toggle = "ON" then
    do shell script "defaults write com.apple.finder AppleShowAllFiles OFF"
  else
    do shell script "defaults write com.apple.finder AppleShowAllFiles ON
  end if

  -- Restart Finder
  tell application "Finder" to quit
  delay 0.5 -- If you have problems, you can tweak the delay
  tell application "Finder" to launch
on error

  display dialog "Unable to toggle bit status." buttons {"Better luck next time"} 
    with icon caution with title "Error"
end try

Notice the reference to delay – if you have problems with the scripting not running properly, you can experiment with a longer delay. There is minimal error handling, essentially just trapping errors and displaying the message below:

I prefer to save AppleScript code as an application, create an icon that serves as a reminder of what the script does, and drag/drop the application onto the Finder toolbar. You can see a screenshot below what my toolbar looks like (the icon for this script is the blue & white Finder image).

And speaking of icons, in an upcoming tip I’ll show you how easy it is to change an application icon on a Mac.

In part 1 of this series I demonstrated how to create a short Java application in NetBeans that communicated, using AppleScript, to the Mac apple event system. The application was a no thrills look into how to invoke the TextEdit application. Despite the brevity of the application it provided the foundation for this next tip, which will build on the ideas to create something a little more salient, as in, something that you might actually find yourself using.

The gist of the application is to instruct iTunes to play a random song, move to the next song, pause, etc. I” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”ll show one use of the application by wrapping the code into a bash script that allows you to invoke the program (and all commands) from within a terminal. Watch the video that follows for all the details…

This application is all of about 80 lines, including the bash script. Sometimes a little creative thinking and a few lines of code are all that” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”s needed to write an intriguing (and hopefully useful) application.


The music in the video is Led Zeppelin and the song: Moby Dick. Led Zeppelin at Amazon


A few weeks back I demonstrated how to write Ruby code inside NetBeans to control scriptable applications on a Mac, that is, communicate between Ruby and the Apple Event system. In this post, I will turn things around a bit from the previous post and use NetBeans and Java to execute AppleScript.

There is a subtle difference, in the previous post the focus was on how to write code in Ruby (inside NetBeans) using the rb-appscript bridge. This time around the approach is to work with Java and pass AppleScript code to a set of Cocoa files (classes) that will act as the bridge between our application and the Mac system.

There is one caveat – the Cocoa-Java API is deprecated as of Mac OS X Tiger. The NSAppleScript and NSMutableDictionary classes are still available, however, they are no longer on the development path within Apple. There are scripting bridges that allow you to control scriptable applications using Python, Ruby, and Objective-C. Java Native Interface (JNI) is an additional option to call platform specific code. You can read more about JNI in this technical note: JNI development on Mac OS X.

One more note, if you follow the steps in this video and the classes NSAppleScript and NSMutableDictionary are shown with lines through them (for example, NSAppleScript), this has to do with a preference setting inside NetBeans to show deprecated classes with a strike-through. You can change this as follows: From the Preferences dialog, choose Fonts/Colors; click the Syntax option; from the Language list choose Java; click on Deprecated Element; in the Effects option, choose None.

Join me in Part 2 of this tip where I” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”ll show a more comprehensive (read: interesting) example where it” onclick=”return TrackClick(”,’javascript%3AlynkVideoPop%28719%2C’)”s all about controlling iTunes using Java.


The music in the video is Led Zeppelin and the song: Moby Dick.
Click the image to see more about about Led Zeppelin and the CD (at Amazon)


I” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”ve found a really nice, well documented, AppleScript application that makes for easy work to use Unix path pattern expansion (glob) syntax along with Finder. This is the utility you want around when you need to select a specific set of files within Finder, and command-clicking just isn” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”t going to cut it.

For instance, when you need to select files with a unique patterns such as: files that contain the string ” onclick=”return TrackClick(” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”,” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”)”test” onclick=”return TrackClick(” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”,” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”)” (anywhere within the filename), or only those files where the name contains ” onclick=”return TrackClick(” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”,” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”)”test” onclick=”return TrackClick(” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”,” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”)” and the extension is ” onclick=”return TrackClick(” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”,” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”)”rb” onclick=”return TrackClick(” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”,” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”)”.

The application I am referring to is lselect, and here are a few examples:

All files with ” onclick=”return TrackClick(” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”,” onclick=”return TrackClick(”,’applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520behavior%2529%250A%2509%2509%250A%2509Select%2520files%2520in%2520the%2520current%2520Finder%2520folder%2520using%2520shell%2520glob%2520syntax.%250A%2509When%2520invoked%252C%2520the%2520user%2520will%2520be%2520prompted%2520to%2520supply%2520a%2520glob%2520pattern.%250A%2509The%2520%2522ls%2522%2520command%2520line%2520utility%2520is%2520used%2520to%2520determine%2520which%2520files%2520match%250A%2509the%2520pattern%252C%2520and%2520then%2520they%2520are%2520selected.%250A%2509%250A%2509Suggested%2520installation%2520location%253A%250A%2509%2509%257E%252FLibrary%252FScripts%252FApplications%252FFinder%252Flselect.scpt%250A%2509%250A%2509The%2520script%2520can%2520be%2520invoked%2520with%2520the%2520standard%2520Mac%2520OS%2520X%2520Script%2520Menu%252C%250A%2509but%2520I%2527ve%2520found%2520FastScripts%2520%2528http%253A%252F%252Fwww.red-sweater.com%252Ffastscripts%252F%2529%250A%2509to%2520be%2520a%2520preferable%2520alternative%252C%2520primarily%2520because%2520of%2520the%2520ease%2520with%2520%250A%2509which%2520reliable%2520keyboard%2520bindings%2520can%2520be%2520assigned.%2520I%2520use%2520Command-G.%250A%2509%250A%2509Issues%253A%250A%2509%2509-%2520If%2520the%2520last%2520match%2520is%2520a%2520directory%2520and%2520the%2520current%2520view%2520type%2520is%250A%2509%2509%2520%2520Column%252C%2520other%2520matches%2520will%2520not%2520end%2520up%2520selected%2520%2528they%2520appear%250A%2509%2509%2520%2520to%2520lose%2520selection%2520when%2520the%2520Finder%2520come%2520to%2520rest%2520on%2520and%2520reveals%2520the%250A%2509%2509%2520%2520contents%2520of%2520the%2520last%2520directory%2529.%2520I%2520don%2527t%2520know%2520how%2520to%2520prevent%2520this.%250A%2509%2509-%2520Spaces%2520must%2520be%2520escaped%2520to%2520match%2520properly%253A%2520%2522iTunes%255C%2520Music%2522%250A%2509%2509-%2520Performance%2520is%2520poor%2520with%2520hundreds%2520of%2520matches%253B%2520see%2520notes%2520below%250A%2509%250A%2509Wishes%253A%250A%2509%2509-%2520Select%2520sub-matches%2520within%2520current%2520selection%250A%2509%2509-%2520Select%2520matches%2520on%2520desktop%2520instead%2520of%2520in%2520%2522Desktop%2522%2520window%250A%2509%2509-%2520Support%2520patterns%2520like%2520%2522..%252F%2522%2520%2528subfolder%2520patterns%2520work%252C%2520but%2520not%2520parent%2529%250A%252A%2529%250A%250Atell%2520application%2520%2522Finder%2522%250A%2509%250A%2509%2528%252A%250A%2509%2509Determine%2520the%2520present%2520working%2520directory%2520as%2520alias%2520and%2520POSIX%2520path.%250A%2509%2509If%2520the%2520insertion%2520location%2520is%2520not%2520a%2520folder%252C%2520use%2520its%2520parent.%2520This%2520is%2520the%250A%2509%2509case%2520when%2520a%2520file%2520is%2520selected%2520in%2520Column%2520view%2520%2528otherwise%252C%2520file%2520selections%250A%2509%2509do%2520not%2520seem%2520to%2520be%2520treated%2520as%2520the%2520insertion%2520location%2529.%250A%2509%252A%2529%250A%2509set%2520pwdAlias%2520to%2520insertion%2520location%2520as%2520alias%250A%2509if%2520not%2520%2528exists%2520folder%2520pwdAlias%2529%2520then%250A%2509%2509set%2520pwdAlias%2520to%2520%2528container%2520of%2520pwdAlias%2529%2520as%2520alias%250A%2509end%2520if%250A%2509set%2520pwd%2520to%2520POSIX%2520path%2520of%2520pwdAlias%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520the%2520user%2520what%2520to%2520select.%2520Dialog%2520time%2520out%2520is%2520equivalent%2520to%2520cancellation.%250A%2509%2509The%2520default%2520%2522Select%2520Matches%2522%2520option%2520clears%2520the%2520current%2520Finder%2520selection%252C%250A%2509%2509whereas%2520%2522Add%2520Matches%2522%2520leaves%2520it%2520intact.%2520Clearing%2520the%2520selection%2520is%2520not%2520done%250A%2509%2509in%2520Column%2520view%2520if%2520the%2520displayed%2520folder%2520is%2520the%2520only%2520thing%2520selected.%250A%2509%252A%2529%250A%2509set%2520dr%2520to%2520display%2520dialog%2520%2522Glob%2520pattern%253A%2522%2520default%2520answer%2520%25C2%25AC%250A%2509%2509%2522%2522%2520buttons%2520%257B%2522Cancel%2522%252C%2520%2522Add%2520Matches%2522%252C%2520%2522Select%2520Matches%2522%257D%2520%25C2%25AC%250A%2509%2509default%2520button%25203%2520cancel%2520button%25201%2520with%2520title%2520pwd%2520giving%2520up%2520after%252060%250A%2509if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522%2522%2520then%250A%2509%2509return%250A%2509else%2520if%2520button%2520returned%2520of%2520dr%2520is%2520equal%2520to%2520%2522Select%2520Matches%2522%2520then%250A%2509%2509try%250A%2509%2509%2509–%2520do%2520not%2520clear%2520selection%2520if%2520the%2520only%2520thing%2520selected%2520is%2520the%2520focal%2520folder%250A%2509%2509%2509if%2520selection%2520as%2520alias%2520is%2520not%2520equal%2520to%2520pwdAlias%2520then%2520select%2520%257B%257D%250A%2509%2509on%2520error%250A%2509%2509%2509–%2520more%2520than%2520one%2520thing%2520already%2520selected%250A%2509%2509%2509select%2520%257B%257D%250A%2509%2509end%2520try%250A%2509end%2520if%250A%2509%250A%2509%2528%252A%250A%2509%2509Initialize%2520list%2520of%2520selected%2520files.%2520Generally%2520identical%2520to%2520selection%2520returned%250A%2509%2509by%2520Finder%252C%2520except%2520the%2520present%2520working%2520directory%2520should%2520not%2520be%2520included%252C%250A%2509%2509which%2520is%2520initially%2520selected%2520in%2520some%2520Column%2520view%2520circumstances%2520%2528see%2520above%2529.%250A%2509%2509This%2520is%2520a%2520little%2520clumsy%253B%2520selection%2520state%2520is%2520vaguely%2520defined%2520in%2520Column%2520view.%250A%2509%252A%2529%250A%2509set%2520selectables%2520to%2520selection%250A%2509try%250A%2509%2509if%2520selection%2520as%2520alias%2520is%2520equal%2520to%2520pwdAlias%2520then%2520set%2520selectables%2520to%2520%257B%257D%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Get%2520the%2520glob%2520pattern%2520given%2520by%2520the%2520user.%250A%2509%2509We%2520treat%2520a%2520blank%2520pattern%2520as%2520cancellation%2520%2528use%2520%252A%2520to%2520select%2520everything%2529.%250A%2509%2509Alternatively%252C%2520omit%2520this%2520conditional%2520to%2520select%2520the%2520containing%2520folder%253B%250A%2509%2509this%2520ought%2520to%2520be%2520the%2520default%2520behavior%2520once%2520%2522..%252F%2522%2520issues%2520are%2520ironed%2520out.%250A%2509%252A%2529%250A%2509set%2520query%2520to%2520text%2520returned%2520of%2520dr%250A%2509if%2520query%2520%253D%2520%2522%2522%2520then%2520return%250A%2509%250A%2509%2528%252A%250A%2509%2509Ask%2520ls%2520for%2520a%2520listing%2520of%2520files%2520that%2520match%2520the%2520given%2520pattern.%250A%2509%2509From%2520the%2520ls%2520man%2520page%253A%250A%2509%2509%2509-d%2520Directories%2520are%2520listed%2520as%2520plain%2520files%2520%2528not%2520searched%2520recursively%2529.%250A%2509%2509If%2520nothing%2520matches%2520the%2520query%252C%2520ls%2520will%2520return%2520an%2520error%253B%2520just%2520stop.%250A%2509%252A%2529%250A%2509try%250A%2509%2509tell%2520me%2520to%2520set%2520matches%2520to%2520do%2520shell%2520script%2520%2528%2522%252Fbin%252Fls%2520-d%2520%2522%2520%2526%2520quoted%2520form%2520of%2520pwd%2520%2526%2520query%2529%250A%2509on%2520error%250A%2509%2509return%250A%2509end%2520try%250A%2509%250A%2509%2528%252A%250A%2509%2509Parse%2520each%2520line%2520of%2520the%2520response%2520from%2520ls%2520as%2520the%2520path%2520to%2520a%2520match.%250A%2509%2509The%2520visibility%2520test%2520is%2520twofold%253A%2520the%2520%2522info%2520for%2522%2520test%2520throws%2520an%2520error%2520on%250A%2509%2509Icon%255EM%2520%2528the%2520full%2520name%2520doesn%2527t%2520survive%2520all%2520translations%2520and%2520transmissions%2529.%250A%2509%2509This%2520try-info-for-visibilty%2520test%2520is%2520the%2520main%2520bottleneck%253B%250A%2509%2509for%2520faster%2520handling%2520of%2520many%2520matches%2520%2528100s%2529%252C%2520replace%2520this%250A%2509%2509repeat%2520body%2520with%2520%2522set%2520end%2520of%2520selectables%2520to%2520matchpath%2520as%2520POSIX%2520file%2522%250A%2509%252A%2529%250A%2509repeat%2520with%2520matchpath%2520in%2520paragraphs%2520of%2520matches%250A%2509%2509set%2520posixmatch%2520to%2520matchpath%2520as%2520POSIX%2520file%250A%2509%2509try%250A%2509%2509%2509set%2520fileinfo%2520to%2520info%2520for%2520posixmatch%2520without%2520size%250A%2509%2509%2509if%2520visible%2520of%2520fileinfo%2520then%2520set%2520end%2520of%2520selectables%2520to%2520posixmatch%250A%2509%2509end%2520try%250A%2509end%2520repeat%250A%2509%250A%2509%2528%252A%250A%2509%2509Conclude%2520by%2520selecting%2520the%2520results.%250A%2509%2509The%2520%2522try%2522%2520protects%2520against%2520cases%2520we%2520don%2527t%2520%255Byet%255D%2520handle%252C%250A%2509%2509such%2520as%2520certain%2520%2522..%252F%2522%2520path%2520traversals%2520and%2520anything%2520else%2520that%2520may%2520come%2520up.%250A%2509%2509If%2520the%2520last%2520item%2520of%2520selectables%2520is%2520a%2520directory%2520and%2520we%2527re%2520using%250A%2509%2509Column%2520view%252C%2520other%2520items%2520may%2520not%2520end%2520up%2520selected.%250A%2509%252A%2529%250A%2509try%250A%2509%2509select%2520every%2520item%2520of%2520selectables%250A%2509on%2520error%2520errMsg%2520number%2520errNum%250A%2509%2509display%2520alert%2520%2522Could%2520not%2520make%2520selection%2520%2528%2522%2520%2526%2520errNum%2520%2526%2520%2522%2529%253A%2522%2520message%2520errMsg%2520as%2520critical%250A%2509%2509return%250A%2509end%2520try%250A%2509%250Aend%2520tell’)”applescript%3A%2F%2Fcom.apple.scripteditor%3Faction%3Dnew%26amp%3Bscript%3D%2528%252A%250A%2509lselect%25201.1%2520by%2520Jim%2520DeVona%250A%2509http%253A%252F%252Fanoved.net%252Flselect.html%250A%25091.0%253A%25201%2520November%25202006%250A%25091.1%253A%252018%2520December%25202006%2520%2528somewhat%2520improved%2520Column%2520view%2520be