setting a menu item by number

I am trying to set the current item in a popup menu. The contents of the menu item may change but the item I want to use will always be the same number in the sequence.

I had read elsewhere on this forum that I can choose it by index such as

tell window "myWindow"
set current menu item of popup button "myPopupButton" to menu item (theNumber)
end tell

but this doesn’t seem to work and generates the error: “Can’t make menu item {1} of window “MyWindow” into type menu item”

what am I doing wrong?


Hi dee,


tell window "myWindow"
	tell popup button "myPopupButton" to set current menu item to menu item (theNumber)
end tell

Thanks, that worked