I’m trying to set the Graph vertical increment in a Numbers Chart, but can’t click on or select the Text Field for the stepper.
It will accept a value, but I cannot work out how to ‘lock’ the entered value. I’ve tried sending a keystroke, but it still reverts to its old setting.
Any advice please on how I can alter the stepper text field value, and have it ‘stick’.
tell application "Numbers"
activate
tell document 1
set maxValue to ""
try
tell sheet 1
tell table 1
set maxValue to 0
repeat with x from 2 to count of cells of column "B"
if value of cell x of column "B" > maxValue then set maxValue to value of cell x of column "B"
end repeat
end tell
end tell
if maxValue > 10000 then
set chartInterval to (maxValue + 10000) div 10000
else
if maxValue > 1000 then
set chartInterval to (maxValue + 1000) div 1000
else
if maxValue > 100 then
set chartInterval to (maxValue + 100) div 100
else
if maxValue > 10 then
set chartInterval to (maxValue + 10) div 10
else
set chartInterval to (maxValue + 1) div 1
end if
end if
end if
end if
end try
end tell # document 1
try
if chartInterval = "" then set chartInterval to "Auto"
tell document 1
tell sheet 1
set width of chart 1 to (width of chart 1)
end tell
end tell
end try
activate
tell application "System Events" to tell process "Numbers"
# tell window 1
tell current application to delay 0.2
click radio button 2 of radio group 1 of window 1
tell current application to delay 0.1
click radio button 1 of radio group 1 of scroll area 3 of window 1
tell current application to delay 1
say (exists text field 3 of scroll area 3 of window 1) --< true
try
click text field 3 of scroll area 3 of window 1
end try
try
select text field 3 of scroll area 3 of window 1
end try
tell current application to delay 0.1
set value of text field 3 of scroll area 3 of window 1 to chartInterval as text —< works, but doesn’t ‘stick’.
# keystroke chartInterval as text
tell current application to delay 0.1
keystroke return
#end tell
end tell
end tell