I'm trying to write a script to do some text cleanup in Tex-Edit Plus.
What I need to do is locate a certain word imbedded in a line several lines down from the top of a document. I then want to delete all of the text from the beginning of the document to just before that word.
i.e. for the three line above, if I wanted to delete from "What" in line one to the word "want" in line two, the result would be:
want to delete all of the text from the beginning of the document to just before that word.
My problem is counting characters.
In Tex-Edit Plus, I can search for "want", and it will correctly search for and highlight it as the selection.
tell application "Tex-Edit Plus" tell window 1 search looking for "want" set x to line offset of selection
I have now located the line that my desired text is on.
What I can't figure out is how to count the characters on that line (or from the beginning of the document, either would work) in order to delete up to that point.
Any suggestions? |