• 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: Anyone tried text searching in Acrobat?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Anyone tried text searching in Acrobat?


  • Subject: Re: Anyone tried text searching in Acrobat?
  • From: "Arthur J Knapp" <email@hidden>
  • Date: Thu, 12 Apr 2001 21:45:00 -0400

> Date: Thu, 12 Apr 2001 18:56:50 +0100
> Subject: Anyone tried text searching in Acrobat?
> From: Guy Parker <email@hidden>

> I'm trying to use a function of Acrobat 4's scripting capability that allows

> tell application "Acrobat 4.0"
> open alias "Macintosh HD:Desktop Folder:Form.pdf"
> find text string "UK"
> end tell

> However, I get the following error when the "find text string" command
> executes but only when I try to search for more than just one character
> (i.e. find text string "U" works!).
>
> --> Acrobat 4.0 got an error: ng not found.

I got the same error as you did, so I spend about half an hour fussing
with it, and I came up with this:


tell application "Acrobat 4.0" -- That's the mangled trademark symbol

-- Acrobat definetely wants to be "frontmost" when you look for
-- text, as well as for a number of it's other commands
--
activate

-- The dictionary says that the string parameter for "find text"
-- should be international text. Now, it seems to me that
-- AppleScript is usually intelligent enough to automatically
-- coerce from one string type to another, but in this case,
-- I obtained dramatically better results by performing an
-- explicict coercion.
--
set str to "goals" as international text

try
-- This should now find the text. If the text does not
-- exist, Acrobat throws an error.
--
find text (document 1) string (str)

-- If the text exists before the current "selection" of the
-- the document, you can specify a wrap around search
--
find text (document 1) string (str) wrap around (true)

on error number -10000

-- error "Acrobat 4.0 got an error: ng not found."
--
-- As I have never cared for the initials "NG", ;-)
-- I made this error more informative:

error ("\"" & str & "\"" & " not found")

end try
end tell


It is unfortunate that Acrobat doesn't seem to return any value to
the script, (actually, it returns an empty string). An offset value
returned from the "find text" command would be really handy, but all
Acrobat actaully does is select the found text in the document.


Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden

Hey, check out:
http://www.LateNightSW.com


  • Prev by Date: errors checking class of item in Finder
  • Next by Date: Re: CGIs with MacOS 9.1 - problem
  • Previous by thread: Re: Anyone tried text searching in Acrobat?
  • Next by thread: Re: Anyone tried text searching in Acrobat?
  • Index(es):
    • Date
    • Thread