• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Find script files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Find script files
      • From: Philip Aker <email@hidden>
References: 
 >Re: Find script files (From: Philip Aker <email@hidden>)

  • Prev by Date: Re: Find script files
  • Next by Date: RE: Simple text - solved.
  • Previous by thread: Re: Find script files
  • Next by thread: Re: Find script files
  • Index(es):
    • Date
    • Thread