Parameter error appears when using splitmenutrigger statement

Setting this:

splitmenutrigger menuname,menuitem

as the code to be executed when I click on a custom menu item, I get an error message:

Cannot set parameter 1 value.

A bug or my fault?

Have you defined the variables menuname and menuitem?

local menuname,menuitem
splitmenutrigger menuname,menuitem

Not the question you asked, but since you are writing new code, I suggest not creating a .CustomMenu procedure and instead embedding the code directly into your menu definitions, for example something like this:

menuitem("Gargle","CODE",{call gargleNow})

The variables were defined. I wasn’t planning on using a .CustomMenu procedure. I don’t know what I’ve changed since posting this query but I no longer have the error message.

I’m using variables to contain the sometimes lengthy code snippets and the menuitem( and arraymenuitems( functions accept them happily. It makes for neater-looking and more readable code.