Re: Searching a volume
Re: Searching a volume
- Subject: Re: Searching a volume
- From: Jon Pugh <email@hidden>
- Date: Wed, 15 Jan 2003 22:24:48 -0800
At 5:57 PM -0600 1/14/03, Dave Balderstone wrote:
>
On OS X, check "man locate"
I have to second this. locate rocks.
I've modified my daily script (in /private/etc/daily) by copying the "rebuilding locate database" chunk from weekly to daily. This is because I download new source code every day and I need it cataloged.
Then I wrote a script which I use in BBEdit. It uses the selection or asks for a string with a dialog. It uses locate with that, returning every file name that contains that string. If there's one it just opens the file in BBEdit. If there is more than one, it puts up a dialog so you can choose one, and it opens that one.
It rocks for software geeks.
Jon
property pLastLocateQuery : ""
tell application "BBEdit"
try
set s to contents of selection
on error number -1728
set s to ""
end try
end tell
if s = "" then
set pLastLocateQuery to text returned of (display dialog "Locate what?" default answer pLastLocateQuery)
else
set pLastLocateQuery to s
end if
set locateResults to do shell script "locate '" & pLastLocateQuery & "'"
set locateResults to every paragraph of locateResults
if number of items of locateResults is 0 then
tell application "BBEdit"
open pLastLocateQuery
end tell
else
if number of items of locateResults > 1 then
set locateResults to choose from list locateResults with multiple selections allowed without empty selection allowed
end if
if locateResults is not false then
repeat with s in locateResults
set f to POSIX file s
tell application "BBEdit"
activate
open f
end tell
end repeat
end if
end if
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.