Re: Finding a location in a text file
Re: Finding a location in a text file
- Subject: Re: Finding a location in a text file
- From: kai <email@hidden>
- Date: Sat, 19 Nov 2005 14:25:36 +0000
On 19 Nov 2005, at 12:50, Jim Brandt wrote:
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.
Your idea to count characters from the beginning of the document is a
sound one, Jim. (In this particular case, line offset merely adds an
unnecessary complication.) You should therefore be able to do the job
with something like this (single line - watch for wraps):
----------------
tell application "Tex-Edit Plus" to tell front document to if search
looking for "want" then delete (text 1 thru character (character
before selection's offset))
----------------
---
kai
_______________________________________________
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