The following searches for the file “findme”. The script is used in a filemaker search script.
How would you restrict the search to a specific folder or drive? As is, the script digs up everything off every drive including stuff archived with time machine or stuff it - which is very clever but makes for a long list most of which is not current projects. Any help greatly appreciated.
Cheers Roger
--set theSEARCHitem to cell "ListFiles" (for filemaker implementation)
set theSEARCHitem to "findme"
set theSCRIPT to "mdfind " & quoted form of theSEARCHitem set theTEXT to (do shell script theSCRIPT)
set theCOUNT to count of paragraphs of the theTEXT
if theTEXT is not "" then
set theFILEALIAS to {}
if theCOUNT = 1 then
set theFILEALIAS to POSIX file theTEXT
else if theCOUNT > 1 then
repeat with i from 1 to theCOUNT
set aFileREF to paragraph i of theTEXT
set theFILEal to POSIX file aFileREF
set end of theFILEALIAS to theFILEal
end repeat
end if
set theFILE to choose from list theFILEALIAS
end if
try
tell application "Finder"
open theFILE
end tell
end try