Re: TextEdit and Text Item Delimiters
Re: TextEdit and Text Item Delimiters
- Subject: Re: TextEdit and Text Item Delimiters
- From: Christopher Nebel <email@hidden>
- Date: Wed, 31 Jul 2002 15:58:50 -0700
On Wednesday, July 31, 2002, at 03:36 PM, email@hidden wrote:
But now I'm trying:
tell app "TextEdit" to set allText to the text of document 1
set keepSafe to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"="}
set keyParagraph to first paragraph whose first text item is "foo"
And the last line gives me the same error... I think this is because
you can't use a filter reference on a list, only on containers (which
is the most annoying part of AS I've found so far).
Oh. Heh. Should have looked at your script a bit more carefully before
suggesting that particular tack. AppleScript knows about both "text
item" and "paragraph", but, as you realized, doesn't support the filter
form (aka "whose") on any built-in types like strings or lists. I agree
that it's very annoying.
As an alternate path, you might try returning to the all-TextEdit
version, but try using "word n" instead of "text item n". Given your
data so far, they amount to the same thing, but won't if you start
throwing in spaces. Failing that, it's always possible to emulate
"whose" expressions using explicit loops. It's a pain and you shouldn't
have to, but it does work.
--Chris Nebel
AppleScript Engineering
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.