• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: TextEdit and Text Item Delimiters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TextEdit and Text Item Delimiters


  • Subject: Re: TextEdit and Text Item Delimiters
  • From: email@hidden
  • Date: Wed, 31 Jul 2002 15:36:22 -0700

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. At first I guessed that that was
because without TE, I have no "paragraph" defined. So I tried this:

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 {return}
set paras to text items of allText

set AppleScript's text item delimiters to {"="}
set keyParagraph to (first paragraph whose first text item is "foo")
of paras

And I get an error in the last line that:
Can't get "foo=bar
sna=foo
bar=pub" whose text item 1 = "foo"

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).

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Seth A. Roby
Scriptwriter Intern
"Life is like an exploded clown. It's really funny until you figure out
what just happened."



Christopher Nebel
<email@hidden To: email@hidden
m> cc: email@hidden
Subject: Re: TextEdit and Text Item Delimiters
07/31/2002 02:53
PM







On Wednesday, July 31, 2002, at 01:35 PM, email@hidden wrote:

> Does TextEdit not understand Text Item Delimiters? ... What's a
> work-around that I could use?

As a matter of fact, TextEdit doesn't understand "text item delimiters",
because they're internal to AppleScript itself and you're talking to
TextEdit. What you could do as a workaround is to copy the contents of
the document into an AppleScript variable, do your work, and then copy
the result back like this:

tell application "TextEdit"
set mytext to the text of document 1
-- mangle mytext...
set the text of document 1 to mytext
end


--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.

  • Follow-Ups:
    • Re: TextEdit and Text Item Delimiters
      • From: Christopher Nebel <email@hidden>
  • Prev by Date: Re: Dose anyone know....
  • Next by Date: Re: TextEdit and Text Item Delimiters
  • Previous by thread: Re: TextEdit and Text Item Delimiters
  • Next by thread: Re: TextEdit and Text Item Delimiters
  • Index(es):
    • Date
    • Thread