Re: Tex-Edit string manipulation.
Re: Tex-Edit string manipulation.
- Subject: Re: Tex-Edit string manipulation.
- From: Charles Arthur <email@hidden>
- Date: Sat, 25 Aug 2001 00:17:03 +0100
On Fri, 24 Aug 2001 11:11:32 -0600, Rachel <email@hidden> tore
her hair out:
>
this looks like it should work, but I keep getting an error: CANT GET
>
CHARACTER 1 OF "".
>
I will play with it at my leisure, but I thought every line had at least a
>
CR. Ideas?
In my own tangling with TE+ (a fine program, but sometimes a bit limiting
in speed) I think I've found that it assumes when you're working with
paragraphs that the delimiter is ASCII 13.
When the line (=para) consists only of ASCII 13, then there's no
character 1, because the first character it encounters is the end of para
character. So character 1 of the line is the empty string. Which doesn't
have a first character.
>
Entity Marc K. Myers spoke thus:
>
> I'd do it this way (it assumes that the text should start in column 26):
>
>
>
> set someSpaces to " "
>
> tell window 1 of application "Tex-Edit Plus"
>
> repeat with i from 1 to (count paragraphs)
>
> set theText to paragraph i
--add in:
if (count characters of theText) > 0
>
> set x to word 1 of theText
>
> set y to text from word 2 to word -1 of theText
>
> set theDiff to 25 - (length of x)
>
> set theText to x & (text 1 thru theDiff of someSpaces) & y
>
> set paragraph i to theText
end if
>
> end repeat
>
> end tell
Of course if you want it *fast* then you'd do it with text item delimiters...
best
Charles
http://www.ukclimbing.com : 1,000+ British crags, 350+ British climbing walls
- searchable by distance rock type, etc, with 5-day weather forecasts for
every one - plus maps, articles, news, and the New Routes database. There's
even a cool shop attached...