G’day scripters
I’ve managed to create new blank Documents in Numbers, & add Tables and positioned Text Boxes, but I’d like to color the text in those boxes (the ‘AddTitle’ routine).
Any ideas?
Regards
Santa
on makeNewDoc(n, d)
tell application "Numbers"
activate
tell application "System Events" to tell process "Numbers"
if exists window "Template Chooser" then
select text field 1 of row 3 of outline 1 of scroll area 2 of window "Template Chooser"
select image 1 of UI element 1 of scroll area 1 of window "Template Chooser"
click button "Choose" of window "Template Chooser"
repeat until exists window "Untitled"
delay 0.1
end repeat
else
tell application "Numbers"
set tempCount to count of windows
end tell
click menu item "New" of menu 1 of menu bar item "File" of menu bar 1
repeat until exists window "Template Chooser"
delay 0.1
end repeat
select text field 1 of row 3 of outline 1 of scroll area 2 of window "Template Chooser"
select image 1 of UI element 1 of scroll area 1 of window "Template Chooser"
click button "Choose" of window "Template Chooser"
repeat while exists window "Template Chooser"
delay 0.1
end repeat
end if
end tell
set temp to first item of ((name of windows) as list)
delete every table of every sheet of every document of window temp
return temp
end tell
end makeNewDoc
on addTitle(TheTitle)
tell application "Numbers"
set temp to first item of ((name of windows) as list)
set the clipboard to (TheTitle)
tell application "System Events" to tell process "Numbers"
try
set value of value indicator 1 of scroll bar 2 of scroll area 2 of splitter group 1 of splitter group 2 of splitter group 1 of window temp to 100
end try
try
tell last UI element of UI element 1 of scroll area 2 of splitter group 1 of splitter group 2 of splitter group 1 of window temp
set {xPosition, yPosition} to position
set {xSize, ySize} to size
end tell
set xpos to xPosition + 40
set ypos to yPosition + ySize + 20
end try
click menu item "Text Box" of menu 1 of menu bar item "Insert" of menu bar 1
click menu item "Delete" of menu 1 of menu bar item "Edit" of menu bar 1
try
set value of value indicator 1 of scroll bar 2 of scroll area 2 of splitter group 1 of splitter group 2 of splitter group 1 of window temp to 100
end try
try
keystroke "v" using command down
end try
try
set value of value indicator 1 of scroll bar 2 of scroll area 2 of splitter group 1 of splitter group 2 of splitter group 1 of window temp to 100
end try
try
tell last UI element of UI element 1 of scroll area 2 of splitter group 1 of splitter group 2 of splitter group 1 of window 1
set position to {xpos, ypos}
end tell
end try
try
set value of value indicator 1 of scroll bar 2 of scroll area 2 of splitter group 1 of splitter group 2 of splitter group 1 of window temp to 100
end try
end tell
end tell
end addTitle
Model: 27" iMac
Browser: Safari 533.19.4
Operating System: Mac OS X (10.6)