(no subject)
(no subject)
- Subject: (no subject)
- From: Pat Cannon <email@hidden>
- Date: Mon, 18 Feb 2002 17:32:04 -0600
...
>
I am desperately trying to find/modify an applescript (drag and drop) that
>
will search for and alert a user for this CalGray type.
...
Try this (you'll probably have to fix a couple line breaks):
--------------------------------------
on open pdfFile
set searchString to "CalGray"
set textFound to false
set chunkSize to 1024 -- read the file in chunks so as to not run out of
memory
set pointer to 1
repeat
try
set nextPointer to pointer + chunkSize
set pdfText to read pdfFile from pointer to nextPointer
if pdfText contains searchString then
set textFound to true
exit repeat
end if
on error -- I'm assuming the error is EOF
exit repeat
end try
set pointer to nextPointer
end repeat
if textFound then
beep 3
display dialog "This file contains the text "" & searchString & ""!"
buttons {"Get Debbie!"} default button 1 with icon stop
else
display dialog "This file does NOT contains the text "" & searchString &
""." buttons {"Cool."} default button 1
end if
end open
--------------------------------------
You can probably speed it up by making chunksize bigger -- this took a
minute and a half to read through a 4.8MB file on my G4.
Good luck,
Pat
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.