Re: Find script files
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