MacResource
Automator or other script experts? - Printable Version

+- MacResource (https://forums.macresource.com)
+-- Forum: My Category (https://forums.macresource.com/forumdisplay.php?fid=1)
+--- Forum: Tips and Deals (https://forums.macresource.com/forumdisplay.php?fid=3)
+--- Thread: Automator or other script experts? (/showthread.php?tid=236424)

Pages: 1 2


Re: Automator or other script experts? - Marc Anthony - 01-18-2020

You may want to try this modification. I think I left out an-a option for binary files. While the text in your output PDF may appear readable in its composite form, the "text" within it may not be so clean. I just tried this on a sample PDF with one visible instance of the searchTerm, but there are actually 20 or so in the file's data contents. Best of luck to you.

set searchTerm to (display dialog 
Input the search string:
default answer
suspect
)'s text returned
(do shell script
fgrep -iraA1
& searchTerm's quoted form & space & (choose folder with prompt
Locate the folder containing the files to be searched.
)'s POSIX path's quoted form)



Re: Automator or other script experts? - deckeda - 01-18-2020

Thanks again. I'll try it later. And yes the rendered output is sometimes fiction. At least one doc has text that when copied to the clipboard, reveals itself to actually be all lower case for the first word in each sentence and adding a space between the last word and period.