Help with an AppleScript - click a menu item which has a name which changes
Object Specifiers
In AppleScript, the way an object is referred to is called the object specifier. In your code, you are using the name specifier.
Try a numeric value for the menu item, such as:
click (menu item 12) of menu &quot;Window&quot; of menu bar 1

Or a relative term, such as:
click the last menu item of menu &quot;Window&quot; of menu bar 1