Re: Find script files
Re: Find script files
- Subject: Re: Find script files
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 10 Jul 2008 11:15:37 -0400
On Thu, Jul 10, 2008 at 9:47 AM, Philip Aker <email@hidden> wrote:
> set search_string to "on doit"
> set falias to (path to desktop)
> tell application "System Events"
> set flist to (POSIX path of every file of falias whose file type is "osas")
Will that use Spotlight's metadata index?
If you're going to call out to osadecompile anyway, it might (or might
not) be simpler to do the whole thing in the shell:
set whatToLookFor to "on doit"
set matchingScriptFiles to paragraphs of (do shell script "mfind
-onlyin ~/Desktop 'kMDItemKind == \"Script\"' | while read f; do
osadecompile \"$f\" | grep -q " & quoted form of whatToLookFor & " &&
echo \"$f\"; done")
or if you only want the first file found:
set matchingScriptFile to POSIX file (do shell script "mfind -onlyin
~/Desktop 'kMDItemKind == \"Script\"' | while read f; do osadecompile
\"$f\" | grep -q " & quoted form of whatToLookFor & " && echo \"$f\"
&& break; done")
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden