From: Simon K. (S. LTD) <sm...@an...> - 2009-10-23 22:18:07
|
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 > |