Have you tried to run it after setting slotNum to 19?
It would be useful to check that the value 18 given to h is the correct one.
When I will be sure of the required value, I will edit message #37 with a code which click button 4 only the needed number of times.
Just for info, below is the script which I used to test the scheme with Numbers.
(*
test with Numbers
*)
use AppleScript version "2.4"
use scripting additions
tell application "Numbers" to activate
tell application "System Events"
tell application process "Numbers"
set frontmost to true
tell window 1
set {wLeft, wTop} to its position
-- get class of UI elements --> {scroll area, button, scroll area, button, button, scroll area, button, button, radio group, UI element, button, button, static text, scroll area, button, button, button, menu button, toolbar, tab, static text, static text}
-- get position of scroll areas --> {{1065, 142}, {1112, 114}, {1065, 1081}, {1897, 323}}
-- get class of UI elements of scroll area 1 --> {scroll bar, scroll bar}
tell scroll bar 2 of scroll area 1
if class of UI elements contains value indicator then --> {value indicator, button, button, button, button}
set oldPos to item 2 of (get position of value indicator 1) --> 963
-- get subrole of buttons --> {"AXIncrementArrow", "AXDecrementArrow", "AXIncrementPage", "AXDecrementPage"}
repeat
click button 4 --> the "AXDecrementPage" one
set newPos to item 2 of (get position of value indicator 1)
if newPos = oldPos then exit repeat
set oldPos to newPos
end repeat
end if
end tell # scroll bar 1
end tell # window 1
end tell # process Numbers
--set {x, y} to {wLeft + 33, wTop + 46} # used for "VeraCrypt"
set {x, y} to {wLeft + 190, wTop + 176}
set h to 20 # was 18 for "VeraCrypt"
set slotNum to 15 # may be 1 thru 20
tell me to do shell script "/usr/local/bin/cliclick c:" & x & "," & (y + slotNum * h)
end tell # Application System Events
--tell application "Numbers" to activate
Here I disabled the instructions which I used to get useful infos.
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 18 décembre 2019 12:12:51
Edited to take care of table small enough so that there is no value indicator in the scroll bar.