• 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: Font, size, and color
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Font, size, and color


  • Subject: Re: Font, size, and color
  • From: Graff <email@hidden>
  • Date: Wed, 14 Jan 2004 12:43:54 -0500

On Jan 14, 2004, at 1:26 AM, Emmanuel wrote:

At 7:52 PM -0500 13/01/04, Graff wrote:
I've been trying to get the font, size of the font, and color of text in Script Editor.app. I have no problem getting the text of a document, and I can even break the text down into "attribute runs" but I've failed every single time I've tried to get the properties of an attribute run. Here's an example that doesn't work:
------------
tell application "Script Editor"
set documentList to every document whose name is "foo.scpt"
set theText to text of item 1 in documentList
set thisRun to attribute run 1 of theText

set theSize to size of thisRun
set theFont to font of (thisRun as attribute run)
set theColor to color of character 1 of thisRun
end tell
------------

Anyone have any idea on how to do this?

Err... what about using another editor, more modern, including a GUI editor and yet free?

Oh, I know it can be done in other editors but I was wondering what had to be done to get it to work in Script Editor. I mean, the terminology is in the Script Editor dictionary so I would assume there must be some way to access these properties.

Here's a relevant entry in the Script Editor dictionary, found under "Text Suite"

Class attribute run: This subdivides the text into chunks that all have the same attributes.
Plural form:
attribute runs
Elements:
character by numeric index, before/after another element, as a range of elements, satisfying a test
attribute run by numeric index, before/after another element, as a range of elements, satisfying a test
attachment by numeric index, before/after another element, as a range of elements, satisfying a test
word by numeric index, before/after another element, as a range of elements, satisfying a test
paragraph by numeric index, before/after another element, as a range of elements, satisfying a test
Properties:
<Inheritance> item [r/o] -- All of the properties of the superclass.
size integer -- The size in points of the first character.
font Unicode text -- The name of the font of the first character.
color color -- The color of the first character.


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

References: 
 >Font, size, and color (From: Graff <email@hidden>)
 >Re: Font, size, and color (From: Emmanuel <email@hidden>)

  • Prev by Date: How do I schedule a script.
  • Next by Date: Re: Slashes in filenames (was: Elementary fie naming question)
  • Previous by thread: Re: Font, size, and color
  • Next by thread: Re: Font, size, and color
  • Index(es):
    • Date
    • Thread