Numbers - Format Column "Pop Up Menu" - How To Set Menu Items?

Hi There,

I am using this script to set format of a cell to pop up menu.
How can I specify what items are present in the list when the user clicks on the cell?

Thanks in advance for your help,
Adam

tell application "Numbers"
	activate
	tell the first table of the active sheet of document 1
		set the format of cell "A1" to pop up menu
	end tell
end tell

Hi.

It doesn’t seem that pop up menus’ contents are directly scriptable in the current version of numbers. However, I’ve had some success with the following, which uses GUI Scripting. Maybe it’ll work for you too.

set menuItems to {"This", "That", "The Other", "Something Else Again"}

tell application "Numbers"
	activate
	tell the first table of the active sheet of document 1
		tell cell "A1"
			-- Set the cell value to the first menu item required. This also selects the cell.
			set value to item 1 of menuItems
			-- THEN set the cell format. This causes the menu to adopt the value just set as a single item instead of having the three default items.
			set the format to pop up menu
		end tell
	end tell
end tell

-- Use GUI Scripting to add the remaining items to the menu. 
tell application "System Events"
	tell application process "Numbers"
		set frontmost to true
		tell window 1
			-- The inspector doesn't have to be visible, but its "Cell" pane does have to be selected.
			click radio button "Cell" of radio group 1
			-- Add the remaining items by clicking the "+" button and typing in the texts the required number of times.
			repeat with i from 2 to (count menuItems)
				click button 1 of group 1 of scroll area -1
				keystroke (item i of menuItems)
			end repeat
		end tell
	end tell
end tell

Thanks Nigel for your help here - much appreciated!
Seems weird that there wouldn’t be some associated parameters with the format-type. Maybe I’ll write a suggestion to Apple.