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 12:21:16 -0400
On 31/05/2009, at 11:29 , Yvan KOENIG wrote:
Le 31 mai 2009 à 17:18, Deivy Marck Petrescu a écrit :
On May 31, 2009, at 10:34, Yvan KOENIG wrote:
Le 31 mai 2009 à 15:52, Deivy Petrescu a écrit :
tell application "TextEdit" to tell document 1 to tell word1 of
paragraph 1 of its text to set g to its properties
I continue to think that you are wrong.
Whe I run:
tell application "TextEdit" to tell document 1 to tell word 1 of
paragraph 1 of its text to set g to its properties
I get this log report:
tell application "TextEdit"
get properties of word 1 of paragraph 1 of every text of document 1
{size:10.0, color:{0, 0, 0}, font:"Monaco", class:text}
end tell
which clearly show that the result is a record.
Your error is that when you ask for class of g, you are assuming
that you will get the class of the object g.
The truth is that you get the property 'class' embedded in the
record.
If you run this script :
tell application "TextEdit"
tell document 1
set g to properties of word 1 of paragraph 1
log class of g
end tell
end tell
tell application "AppleWorks 6"
set props to (get properties of document 1)
log class of props
end tell
It will be more clear:
tell application "TextEdit"
get properties of word 1 of paragraph 1 of document 1
{size:10.0, color:{0, 0, 0}, font:"Monaco", class:text}
(*text*)
end tell
tell application "AppleWorks 6"
get properties of document 1
{class:text document, name:"sans titre", index:1, modified:true,
title:"", margins:{72, 72, 72, 72}, author:"", version:"",
keywords:"", category:"", description:"", autohyphenate:false,
file:false, merge file:false, date format:numeric date, fractional
character widths:false, smart quotes:true, side handles:true,
polygon autoclose:false, show invisibles:false, smooth fonts:true,
word wrap:true, autosmooth:true, shift constraint:45}
(*text document*)
end tell
The record sent by TextEdit contains the property: class:text
The one sent by AppleWorks contains the property: class:text
document.
I don't want to be rude but what is buggy is your analysis, not
the behavior.
Yvan KOENIG (from FRANCE dimanche 31 mai 2009 16:33:01)
Yvan, I apologize for buggy analysis but see how interesting:
tell application "TextEdit"
set props to (get properties of text of document 1)
log class of props
props as record
end tell
--->{class:text, color:{0, 0, 0}, size:12.0, font:"Helvetica-Bold"}
tell application "TextEdit"
set props to (get properties of text of document 1)
log class of props
try
props as text
on error e
return e
end try
end tell
---> "Can’t make {class:text, color:{0, 0, 0}, size:12.0, font:
\"Helvetica-Bold\"} into type Unicode text."
I call this a bug!
And I call this a wrong analysis.
The returned class is not the class of the record,
it is the class of the object whose properties are returned !!!!!
Yvan KOENIG (from FRANCE dimanche 31 mai 2009 17:28:56)
Yvan,
I apologize! You are right.
I never saw the class inside the record.
I went back to see why I raised the issue and how come I did not see
that.
I looked at Mail and certain properties of the messages were not being
returned outside the tell block.
I understand that for a double word record, but not for a single word.
However I checked now and other apps have the same problem and it is a
bit random.
I do have a problem with that, because once the record is defined, it
should be in parts at least, be defined everywhere.
so if I write the script:
set rec to {deivy:"wrong", yvan:"right"}
get yvan of rec
--->right
Although there is not "yvan" in AS. "yvan" became a variable once I
defined rec and the script gets the value of the variable "yvan" in rec.
The same does not happen when I get the record via getting properties.
So:
tell application "BBEdit" to set pt to properties of document 1
log id of pt -- id is a property for the script
log modified of pt -- modified is a property for the script
log modifiable of pt -- modifiable is a variable and the script errors
here. I don't know if this should happen.
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