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)
---> "Can’t make {class:text, color:{0, 0, 0}, size:12.0, font:\"Helvetica-Bold\"} into type Unicode text."