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

Re: Reading a pdf text file


  • Subject: Re: Reading a pdf text file
  • From: yvan-koenig <email@hidden>
  • Date: Sun, 9 Jan 2005 10:28:17 +0100


Le 9 janv. 2005 , à 08:56, Gil Dawson a écrit :

I've had some success reading a pdf file using Adobe Reader with UI scripting, and I thought I'd share what works so far (on 10.3.7 using Classic Script Editor 1.8.3):

property pdfFile : alias "Path:to:file.pdf"
tell application "Adobe Reader" to open pdfFile
tell application "BBEdit 4.5" to activate -- let's clear its window now
tell application "System Events"
keystroke "a" using command down -- Select All
keystroke (ASCII character 8) using command down -- Delete key
end tell
set prevPageAsText to "" -- part of a flaky attempt to detect eod that didn't work
repeat 15 times -- number of pages
tell application "System Events"
tell process "Adobe Reader"
set frontmost to true
click menu item "Select All" of menu "Edit" of menu bar 1 -- select this page as text
-- keystroke "a" using command down -- this also works
delay 1 -- let the select complete
click menu item "Copy" of menu "Edit" of menu bar 1
-- keystroke "c" using command down -- this also works
delay 1 -- let the clipboard fill
click menu item "Next page" of menu "Go To" of menu item "Go To" of menu "View" of menu bar 1
-- keystroke (ASCII character 29) -- Right Arrow = Next page -- also works
-- set thisPageAsText to (the clipboard as text) --> Error -619
end tell
end tell
tell application "BBEdit 4.5" to activate
tell application "System Events" to keystroke "v" using command down -- paste
tell application "System Events" to keystroke return -- return
tell application "System Events" to keystroke return -- return
end repeat

As a french user, I wish to write that using the keystroke shortcuts is better as it give a script which may be used worldWide.
Using menu names doesn't.


When shortcuts are not available, we may use menu by number .
In some circumstances, using the number doesn't work but there is an available trick:


grab the item from its number then, use the grabbed name.

Remember, we are NOT all using english.

CAUTION at this time keystroke "i" or "I" send "q" or "Q" when used on a french keyboard.

Yvan KOENIG (from FRANCE)


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Reading a pdf text file (From: Gil Dawson <email@hidden>)
 >Re: Reading a pdf text file (From: Roger Howard <email@hidden>)
 >Re: Reading a pdf text file (From: Gil Dawson <email@hidden>)
 >Re: Reading a pdf text file (From: Emmanuel <email@hidden>)
 >Re: Reading a pdf text file (From: Gil Dawson <email@hidden>)

  • Prev by Date: Re: Reading a pdf text file
  • Next by Date: Re: FTP Server to dynamically create users
  • Previous by thread: Re: Reading a pdf text file
  • Next by thread: Re: Reading a pdf text file
  • Index(es):
    • Date
    • Thread