Faced with the task of trying to script a midiin object with an argument for the port, for example:midiin "IAC Driver 1"
one may find it puzzling.
The tricky part is getting the symbol of the port name into the symbol of the new object text. Here’s how it works:

-- Pasted Max Patch, click to expand. --

Copy all of the following text. Then, in Max, select New From Clipboard.