Re: getting chunks of text
Re: getting chunks of text
- Subject: Re: getting chunks of text
- From: Scott Haneda <email@hidden>
- Date: Wed, 16 Mar 2005 21:53:17 -0800
on 3/16/05 9:17 PM, Michelle Steiner at email@hidden wrote:
> set foo to sometext --replace "sometext" with real text
> if length of foo is greater than 256 then
> set bar to text 1 through 256 of foo
> repeat until the last character of bar is space
> set bar to text 1 through -2 of bar
> end repeat
> set bar to text 1 through -2 of bar
> else
> set bar to foo
> end if
>
> The above script assumes that if the original text is 256 characters or
> less, it doesn't matter whether it ends with a word.
>
> Alternatively, if you don't mind stripping punctuation in the middle of
> the text, try this:
>
> if length of foo is greater than 256 then
> set bar to text 1 through 256 of foo
> if character 257 of foo is not space then
> set bar to words 1 through -2 of bar
> set text item delimiters to space
> set bar to bar as text
> set text item delimiters to ""
> end if
> else
> set bar to foo
> end if
> bar
Thanks, I think you understood me, basically, SMS messages are limited in
length, I want to take a given input string and chop it up so it can be sent
as multiple messages.
So for example, I have this:
set MyMessage to make new outgoing message with properties ¬
{recipient:"email@hidden", subject:"SMS",
content:body}
send MyMessage
which tells entourage to send a email, how do I parse the input text with
your above code and then repeat through the chunks to send x messages?
Thanks for the help.
--
-------------------------------------------------------------
Scott Haneda Tel: 415.898.2602
<http://www.newgeo.com> Novato, CA U.S.A.
_______________________________________________
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