Wednesday, June 26, 2019

#1 2018-10-12 12:05:32 pm

Registered: 2006-01-19
Posts: 7

Automating Numbers to create a cell border

I've been automating numbers and the one thing I am stuck on is cell borders. I've found some suggestions which appear to be for older versions of Numbers and where I am at is the following script:


tell application "Numbers"
   tell document 1 to tell active sheet to tell table 1
       set selection range to range "D13:AG13"
   end tell
end tell

tell application "System Events" to tell process "Numbers"
   if menu item "Show Inspector" of menu 1 of menu bar item "View" of menu bar 1 exists then
       keystroke "i" using {option down, command down} -- “Show Inspector” menu command
   end if
   tell window 1 -- inspector window
       click radio button "Cell" of radio group 1
       tell scroll area 4
           tell button 3 of list 1
               set {xPosition, yPosition} to position
               set {xSize, ySize} to size
           end tell
           click at {xPosition + (xSize div 2), yPosition + (ySize div 2)}
           select button 3 of list 1
           click button 3 of list 1
           click menu button "Border Styles"
           click menu item "1 pt" of menu 1 of menu button "Border Styles"
       end tell
   end tell
end tell

What is not working is the "select button 3 of list 1" which fails to click on the all borders selection of the 3x3 grid that selects different border types. I can see  'Border' box cell getting selected, but it doesn't change colour when clicked by AppleScript in the way that a real mouse click does.

Feels so close to what I want!



#2 2018-10-13 04:05:05 am

Yvan Koenig
Registered: 2006-09-14
Posts: 3460

Re: Automating Numbers to create a cell border

Try to extract the coordinates of the button then trigger it using Cliclick available at :

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) samedi 13 octobre 2018 12:04:54



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)