On Oct 24, 2009, at 17:06, Simon Knight (SKIDS LTD) wrote:
Hi,
I am still attempting to write an Applescript to extract certain
pages of text from a PDF document displayed in Skim. The code I
have extracts a page of text each time the search item is found.
This means that it the item appears more than once on a page then
that page is out put more than once. I would like to be able to
find the number of the page that the search item is found to see if
that page has been output before but I have not been able to extract
the page number (or much else) from the list item that the find
routine returns. What is annoying is that Script Debugger reveals
that the information exists in the variable, I am just unable to
extract it for use in my code.
I use this to do the find inside a "tell document 1" construct :
set theSel to find text theText
Looking at the variable "theSel" in Script Debugger shows that it is
a list of one item; item 1 is displayed with a value of characters
724 thru 731 of text of page 52 of document "diveintopython.pdf".
If I drag item 1 into code editor Script Debugger inserts the
following code:
tell application "Skim"
tell document "diveintopython.pdf"
tell page 52
tell text
tell characters 724
thru 731
-- your code
goes here
end tell
end tell
end tell
end tell
end tell
I reason that if Script Debugger is able to extract the page number
then so should AppleScript.
Why? The fact that some program can extract some number does not mean
that AppleScript has a way to extract that number. Script Debugger is
not written in AppleScript, it's a (probably Cocoa) program.
Any idea how it may be achieved?
best wishes and thanks
Simon
Anyway, Skim's scripting support does have a way to extract the index,
namely the "get index for" command. So you'll have to get the page for
the selection returned by the find command (get pages for) and then
get the index for that page.
Christiaan
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Skim-app-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-users