Christian,
I'm using OS 10.5.8 and SKIM version 1.3.1 (49). I have just managed
to get past the find statement by removing the tell document 1 block.
I now get the infinite loop which is new as previously the second an
subsequent finds moved forward through the document.
When I run the code below it fails at the line "set thesel to find
text thetext" with the error "Applescript Error - Skim got an error:
The in parameter is missing for find text.
I have managed to get the following to work " set thesel to find of
document 1 text the text " having removed the tell document 1 statement.
Have I understood the syntax of find correctly in that it should be
written as " Set theResult to find TargetDocument text SearchString.
Simon
On 23 Oct 2009, at 23:43, Christiaan Hofman wrote:
> This works for me (except that the script loops infinitely). What OS
> are you running on and what exactly does the error say? Have you tried
> just singling out problems using some simple test scripts?
>
> Christiaan
>
> On Oct 24, 2009, at 0:17, Simon Knight (SKIDS LTD) wrote:
>
>> Hi,
>> A year or so ago I modified one of the Apple scripts posted on the
>> Skim Wiki to allow Skim to export the text of pages that contained
>> key
>> text. I have just attempted to run the scripts and neither of them
>> work. I have spent time searching the web and this list has hinted
>> that it could be an Apple Script problem. I did try changing the
>> Applescript dictionary file as detailed in a post in Feb 09 but this
>> just caused the script to fail at an earlier point. The script
>> operating with the latest version of Skim fails at
>>
>> set theSel to find text theText
>>
>> with an error of a missing in clause. Please note that my line is
>> inside a tell document 1 statement. I have been unable to get the
>> find to work. Any ideas?
>>
>> Thanks for reading
>> Simon
>>
>> The full script is here:
>>
>>> tell application "Skim"
>>> activate
>>>
>>> if (count of documents) is 0 then
>>> beep
>>> display dialog "No documents found." buttons {"•"} default
>>> button
>>> 1 giving up after 3
>>> return
>>> end if
>>>
>>> --set noteType to my chooseNoteType({"Highlight", "Underline",
>>> "Strike Out", "Circle", "Box"})
>>> --if noteType is 0 then return
>>>
>>> (* This routine takes the selected text in a skim document and
>>> creates a new document in text edit based on the finds in the source
>>> document
>>> *)
>>>
>>> tell document 1
>>> set theText to contents of ((get text for (get selection)))
>>> display dialog "Enter Search String:" default answer theText
>>> buttons {"Cancel", "OK"} default button "OK" cancel button "Cancel"
>>>
>>> set theText to text returned of result
>>>
>>> set numberOfMatches to 0
>>> set DocumentText to ""
>>> set theSel to find text theText
>>> --set PreviousPage to get index for current page
>>> -- set PreviousPage to 0
>>> repeat while theSel is not {}
>>> set numberOfMatches to numberOfMatches + 1
>>> --set PresentPage to get index for current page
>>> --if PresentPage = PreviousPage then
>>> -- do nothing we have this page
>>> --else
>>> set thePage to last item of (get pages for theSel)
>>> set thepagetext to text of thePage
>>> --set DocumentText to DocumentText & return &
>>> "~formfeed~" &
>>> thepagetext
>>> set DocumentText to DocumentText & return & "--------" &
>>> numberOfMatches & "--------" & return & thepagetext
>>> --set PreviousPage to PresentPage
>>> --end if
>>>
>>> --set thesel to find text theText from thesel
>>>
>>> end repeat
>>>
>>> end tell
>>>
>>> beep
>>> display dialog "Done selecting " & numberOfMatches & " occurences
>>> of \"" & theText & "\"." buttons {"•"} default button 1 giving up
>>> after 3
>>> end tell
>>> tell application "TextEdit"
>>>
>>> set MyDoc to make new document at end of documents with properties
>>> {name:"Extract", text:DocumentText}
>>>
>>> tell MyDoc
>>> set font of paragraphs to "Courier"
>>> set size of paragraphs to 11
>>> end tell
>>>
>>> end tell
>>>
>>
>> ------------------------------------------------------------------------------
>> 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
>
>
> ------------------------------------------------------------------------------
> 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
>
------------------------------------------------------------------------------
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