• 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: Is this a major bug or not?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is this a major bug or not?


  • Subject: Re: Is this a major bug or not?
  • From: Yvan KOENIG <email@hidden>
  • Date: Fri, 29 May 2009 16:54:57 +0200


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.

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.

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

  • Follow-Ups:
    • Re: Is this a major bug or not?
      • From: Deivy Petrescu <email@hidden>
References: 
 >Is this a major bug or not? (From: Deivy Marck Petrescu <email@hidden>)

  • Prev by Date: Is this a major bug or not?
  • Next by Date: RE: In Design - Copy/Paste image without original file
  • Previous by thread: Is this a major bug or not?
  • Next by thread: Re: Is this a major bug or not?
  • Index(es):
    • Date
    • Thread