Re: Is this a major bug or not?
Re: Is this a major bug or not?
- Subject: Re: Is this a major bug or not?
- From: Deivy Petrescu <email@hidden>
- Date: Sun, 31 May 2009 09:52:28 -0400
On 29/05/2009, at 17:56 , Nigel Garvey wrote:
Deivy Marck Petrescu wrote on Fri, 29 May 2009 10:27:04 -0400:
I was writing some scripts for TextEdit and came upon this which I
find a problem
Trying this script (one line):
tell application "TextEdit" to tell document 1 to tell its text to
return properties of attribute run of word 1
I get this:
-->{{class:text, color:{0, 0, 0}, size:14.0, font:"Verdana-Bold"}}
Notice that this is a list not a record.
Hi, Deivy. Attribute runs are _elements_ of text, not properties. The
list is to contain the properties of _every_ attribute run of word 1.
Since there's only one such run, there's only one record in the
list. The
bug seems to be that 'attribute run of word 1' compiles and doesn't
error
when executed.
tell application "TextEdit" to tell document 1 to tell its text to
return properties of attribute run 1 of word 1
NG
Nigel (and Yvan)
I do know what attribute run is. I know it is not a property, so much
so that I asked for its properties.
There is no bug in using attribute run instead of attribute run 1.
Firstly, for the reason that Yvan posted, secondly because you can try
to see that the following script works:
tell application "TextEdit" to tell document 1 to tell words of
paragraph 1 of its text to return properties
I think Yvan's examples are correct and I take that my first point in
the original email is wrong!
However, the major bug I referred to in my original email was not the
point above, the major bug is the following; whatever way you want,
get the properties either of a word or of an attribute run or whatever
in TextEdit.
Using the script above, change it to
tell application "TextEdit" to tell document 1 to tell word1 of
paragraph 1 of its text to set g to its properties
class of g
---> text
This is the bug! Properties are records not text!
The problem is now that you've created a record, "g", you can only use
it inside a "tell TextEdit" block to access it.
This should not be so!
I've checked and other apps return class of properties as record,
Mail, TextEdit return as "text", "message", etc.
Philosophically this might be right, but this is not philosophy is
programming! :)
Deivy Petrescu
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden