I'm trying to make applescript for an application called F.lux, which clicks on the โDisable for an hourโ menu item, as shown in the screenshot below:

The path to the element is shown in the screenshot below:

Here is my code:
tell application "System Events" tell process "Flux" click (menu bar item 1 of menu bar 2) click menu item "Disable for an hour" of menu 1 of menu bar item 1 of menu bar 2 end tell end tell
Everything compiles fine, however I keep getting the error message below when I try to run the script:
error "System events received an error: I can not get menu 1 of menu line 1 in menu line 2 of the" Flux "process. Invalid index." number -1719 from the menu 1 line menu item 1 line of the menu 2 of the process "Flow"
Can someone determine where I am wrong?
source share