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: Fri, 29 May 2009 11:29:00 -0400
On 29/05/2009, at 10:54 , Yvan KOENIG wrote:
Le 29 mai 2009 à 16:27, Deivy Marck Petrescu a écrit :
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. To get the record I have
to refer to item 1 of this list.
I did not remember any other app returning properties like this, so
I checked "Mail" to see what it returns for the following script
(one line):
tell application "Mail" to tell message 1 of mailbox 1 of account 1
to set pt to (get its properties)
I get this:
-->{content:"If you can't see the images below", was replied
to:false, message id:"xxx", reply to:"xxx" , sender:"xxx",
mailbox:mailbox "INBOX" of account "deivy" of application "Mail",
subject:"xxx", read status:true, was redirected:false, date
received:date "Friday, May 29, 2009 9:46:54 AM", source:"Return-
Path: ", date sent:date "Friday, May 29, 2009 9:19:24 AM",
floating:false, all headers:"From: ", id:11477, was
forwarded:false, class:message, message size:10651, deleted
status:false, background color:none, junk mail status:false}
Where xxx substitutes the real thing! As I suspected properties
should have returned a record not a list.
The propblem is, if I try to get the class of pt (properties) it
returns "message"!!!
Even if you try the following after the one line script above:
get class of (pt as record)
--> message
This is a problem. Now pt must be used within a "Mail" tell block
to make sense.
If one tries the following after the above script outside the tell
block:
was replied to of pt
one gets an error. That shouldn't be!
So I tried a similar script with a non Apple application, BBEdit.
The following script:
tell application "BBEdit" to tell document 1 to tell its text to
set pt to properties
class of pt
---> record
The script returns pt as record and it recognizes it as record.
I think this is a major bug. I do not remember it being discussed
here.
Am I alone in my impression?
This should be corrected asap!
As far as I know, the dictionnary just states that it returns three
properties.
It doesn't states that it returns one record or a list of records.
Yvan, properties are records.
So, "return property" should return a record
When I read:
attribute run n [inh. item] : This subdivides the text into chunks
that all have the same attributes.
I guess that the item may embed several chunks so, I'm not really
surprised to get a list of records.
After all, we may have a color for character 1
an other one for the other characters.
This is a good point, however, if i run
tell application "TextEdit" to tell document 1 to tell paragraph 1 of
its text to return attribute run's properties of every character
--->{{{font:"Verdana-Bold", color:{0, 0, 0}, class:text, size:14.0}},
{{font:"Verdana-Bold", color:{0, 0, 0}, class:text, size:14.0}},
{{font:"Verdana-Bold", color:{0, 0, 0}, class:text, size:14.0}},
{{font:"Verdana-Bold", color:{0, 0, 0}, class:text, size:14.0}},
{{font:"Verdana-Bold", color:{0, 0, 0}, class:text, size:14.0}},
{{font:"Verdana-Bold", color:{0, 0, 0}, class:text, size:14.0}},
{{font:"Verdana-Bold", color:{0, 0, 0}, class:text, size:14.0}},
{{font:"Verdana-Bold", color:{0, 0, 0}, class:text, size:14.0}},
{{font:"Verdana-Bold", color:{0, 0, 0}, class:text, size:14.0}},
{{font:"Verdana-Bold", color:{0, 0, 0}, class:text, size:14.0}},
{{font:"Verdana-Bold", color:{0, 0, 0}, class:text, size:14.0}}}
You see that now we have a list of a list of records.
That does not seem right.
Yvan KOENIG (from FRANCE vendredi 29 mai 2009 16:54:24)
_______________________________________________
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