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 Marck Petrescu <email@hidden>
- Date: Sun, 31 May 2009 11:18:55 -0400
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!
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