Le 25 avr. 2010 à 11:37, Axel Luttgens a écrit :
tell application "System Events"
tell application process "Numbers"
tell outline 1 of scroll area 1 of splitter group 1 of splitter group 1 of window dName
tell (first row whose value of static text 1 is sName and settable of attribute "AXDisclosing" is true)
set value of attribute "AXDisclosing" to true
end tell
end tell
end tell
end tell
I found a case when the script doesn't recognise a sheet row.
It's when the sheet doesn't contain tables. Such a sheet may contain text block, media items or nothing at all.
Given that, for safe I will continue to identify sheet comparing size to the size of row 1 which is always a sheet one.
--=====
set s_Name to "main"
tell application "Numbers" to set d_Name to name of document 1
my selectSheet(d_Name, s_Name)
--=====
on selectSheet(dName, sName)
tell application "Numbers" to activate
tell application "System Events" to tell application process "Numbers" to tell outline 1 of scroll area 1 of splitter group 1 of splitter group 1 of window dName
set sheetSize to (get size of row 1)
tell (first row whose value of static text 1 is sName and size is sheetSize)
select it
if settable of its attribute "AXDisclosing" is true then set value of attribute "AXDisclosing" to true
end tell -- (first row
end tell -- System Events…
end selectSheet
--=====
Yvan KOENIG (VALLAURIS, France) dimanche 25 avril 2010 14:16:20