• 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: preflighting a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: preflighting a file


  • Subject: Re: preflighting a file
  • From: Pat Cannon <email@hidden>
  • Date: Mon, 18 Feb 2002 18:07:06 -0600

[This time with a subject header -- sorry everybody.]


...
>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.
_______________________________________________
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.

References: 
 >preflighting a file (From: Debbie McNerney <email@hidden>)

  • Prev by Date: (no subject)
  • Next by Date: Re: (no subject)
  • Previous by thread: Re: preflighting a file
  • Next by thread: Re: preflighting a file
  • Index(es):
    • Date
    • Thread