• 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: Philip Aker <email@hidden>
  • Date: Thu, 10 Jul 2008 11:04:53 -0700

On 08-07-10, at 08:15, Mark J. Reed wrote:

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?

No. And it can't be guaranteed that an arbitrary user has Spotlight enabled for a particular volume.



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:

Yes and maybe faster, so something like:

cd ~/Desktop;ls *.scpt | while read f; do osadecompile ${f} | grep -q 'colorToFCP' && echo ${f};done;

works in Terminal but I'm having trouble somewhere along the way getting it too work in Script Editor.

I think I'd have to 2>/dev/null somewhere in there…


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")


Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@

Democracy: Two wolves and a sheep voting on lunch.

_______________________________________________
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: "Mark J. Reed" <email@hidden>
References: 
 >Re: Find script files (From: Philip Aker <email@hidden>)
 >Re: Find script files (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: Adobe Scripting Survey
  • Next by Date: Re: Adobe Scripting Survey
  • Previous by thread: Re: Find script files
  • Next by thread: Re: Find script files
  • Index(es):
    • Date
    • Thread