I would want an applescript to get the context menu of the current sheet’s scroll area in Numbers 3.5.2:" Rename…, duplicate etc". This works, but you have to specify the name of the sheet. Can I modify it so it works with current sheet?
activate application "Numbers"
tell application "System Events"
tell process "Numbers"
set {xPos, yPos} to position of static text "Sheet 1" of scroll area 2 of window 1
end tell
end tell
tell me to do shell script "/usr/local/bin/cliclick kd:ctrl c:" & xPos & "," & yPos
Fred
Running Numbers v3.5.2 you may try :
tell application "Numbers"
activate
tell document 1
set indexOfTargetSheet to 3
set targetSheet to name of sheet indexOfTargetSheet
set active sheet to sheet targetSheet
end tell
end tell
tell application "System Events"
tell process "Numbers"
# UI elements of scroll area 2 of window 1
set {xPos, yPos} to position of static text targetSheet of scroll area 2 of window 1
end tell
end tell
tell me to do shell script "/usr/local/bin/cliclick kd:ctrl c:" & xPos & "," & yPos
It’s safer to extract the name of the sheet because we can’t trust that sheet 3 is named “Sheet 3”, “Feuille 3” or why not “Autumn Leave”
Yvan KOENIG (VALLAURIS, France) mercredi 25 mars 2015 16:16:18
Thanks Yvan,
Maybee you missunderstood what I wanted. I wanted to rightclick on the scroll area of the active sheet.
I modified your code a bit and this works
tell application "Numbers"
activate
tell document 1
--set indexOfTargetSheet to 3
--set targetSheet to name of sheet indexOfTargetSheet
--set active sheet to sheet targetSheet
set targetSheet to name of active sheet
end tell
end tell
tell application "System Events"
tell process "Numbers"
# UI elements of scroll area 2 of window 1
set {xPos, yPos} to position of static text targetSheet of scroll area 2 of window 1
end tell
end tell
tell me to do shell script "/usr/local/bin/cliclick kd:ctrl c:" & xPos & "," & yPos
Thank you very much!
Fred