• 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
when words aren't words
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

when words aren't words


  • Subject: when words aren't words
  • From: Bill Briggs <email@hidden>
  • Date: Mon, 14 Nov 2005 08:31:21 -0400

A little debugging on a script last night revealed that "words" as seen by AppleScript aren't always what "words" are to an application.

If you were to make a text document in Tex-Edit Plus and put in this line (a fake file path)

thisis ashort/path/to/files/wherethere/are some/directory/names with/spaces

then run this script.

tell application "Tex-Edit Plus"
	tell front document
		set w to words of paragraph 1
		set x to text of paragraph 1
	end tell
end tell
set y to words of x
{w, ASCII character 13, y}


--> {{"thisis", "ashort/path/to/files/wherethere/are", "some/directory/names", "with/spaces"}, "
", {"thisis", "ashort", "path", "to", "files", "wherethere", "are", "some", "directory", "names", "with", "spaces"}}

Words as seen by Tex-Edit Plus are not words as defined by the AppleScript Language Guide. Useful,  but not the same. TextEdit gives the same result as AppleScript.

It sure would be nice if text processing applications had their own text item delimiters. More than a decade ago a little application called Scriptable Text Editor was supposed to show how it was to be done. That bare bones text editor had its own text item delimiters.

- web
 _______________________________________________
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

  • Prev by Date: Setting User Interaction Level in CS2
  • Next by Date: Re: robust handling of return values
  • Previous by thread: Adobe InDesign applied object style
  • Next by thread: Re: when words aren't words
  • Index(es):
    • Date
    • Thread