Below is a test patch and attached is a js file. Any help would be much appreciated.
-- Pasted Max Patch, click to expand. --
Copy all of the following text. Then, in Max, select New From Clipboard.