I wish to add that, once, the created table wasn’t floating but inline.
So it may be a good idea to add the instruction setting the correct status.
tell application "Pages" to tell document 1
properties of graphics
add table data {{"a1", "b1", "c1"}, {"a2", "b2", "c2"}} header column no header row no
set placement of table -1 to fixed # ADDED
set properties of table -1 to {name:"notable", horizontal position:22.0, vertical position:400.0}
add table data {{"aa1", "bb1", "cc1"}, {"aa2", "bb2", "cc2"}} header column no header row no
set placement of table -1 to fixed # ADDED
set properties of table -1 to {name:"potable", horizontal position:82.0, vertical position:500.0}
properties of graphics
end tell
Of course, adding the instructions posted by Nigel to guarantee the correct unit is a good idea.
In my original message, the instructions
properties of graphics
were included to let you see that the logic ruling the ordering of objects descriptors is not evident.
If we really need to get properties of graphics, due to the fact (bug ?) that asking for the properties of a group fails, we must use something like :
tell application "Pages" to tell document 1
set listeProps to {}
count of graphics
repeat with g from 1 to result
try
properties of graphic g
on error
set fakeRecord to {}
tell graphic g
try
shadow
set end of fakeRecord to {"shadow:", result}
end try
try
alpha threshold
set end of fakeRecord to {"alpha threshold:", result}
end try
try
horizontal position
set end of fakeRecord to {"horizontal position:", result}
end try
try
stroke color
set end of fakeRecord to {"stroke color:", result}
end try
try
locked
set end of fakeRecord to {"locked:", result}
end try
try
stroke type
set end of fakeRecord to {"stroke type:", result}
end try
try
opacity
set end of fakeRecord to {"opacity:", result}
end try
try
placement
set end of fakeRecord to {"placement:", result}
end try
try
replaceable
set end of fakeRecord to {"replaceable:", result}
end try
try
name
set end of fakeRecord to {"name:", result}
end try
try
class
set end of fakeRecord to {"class:", result}
end try
try
rotation
set end of fakeRecord to {"rotation:", result}
end try
try
text fit
set end of fakeRecord to {"text fit:", result}
end try
try
wrap
set end of fakeRecord to {"wrap:", result}
end try
try
containing page
set end of fakeRecord to {"containing page:", result}
end try
try
stroke width
set end of fakeRecord to {"stroke width:", result}
end try
try
id
set end of fakeRecord to {"id:", result}
end try
try
shadow offset
set end of fakeRecord to {"shadow offset:", result}
end try
try
width
set end of fakeRecord to {"width:", result}
end try
try
shadow opacity
set end of fakeRecord to {"shadow opacity:", result}
end try
try
shadow blur
set end of fakeRecord to {"shadow blur:", result}
end try
try
extra space
set end of fakeRecord to {"extra space:", result}
end try
try
height
set end of fakeRecord to {"height:", result}
end try
try
shadow angle
set end of fakeRecord to {"shadow angle:", result}
end try
try
shadow color
set end of fakeRecord to {"shadow color:", result}
end try
try
vertical position
set end of fakeRecord to {"vertical position:", result}
end try
try
containing layer
set end of fakeRecord to {"containing layer:", result}
end try
end tell
fakeRecord
end try
set end of listeProps to result
end repeat
listeProps
end tell
It’s really odd. I assumed that trying to grab the shadow, rotation, text fit,wrap, shadow offset, shadow opacity, shadow blur, extra space, shadow angle, shadow color of a group would issue an error but they don’t.
Errors are issued by :
alpha threshold, stroke color, stroke type and stroke width
name doesn’t issue an error but return nothing so if we want to use the result we get the error “undefined variable”.
Yvan KOENIG (VALLAURIS, France) lundi 31 décembre 2012 10:55:10