7 Aug 2025 – See also Another Tip for MBS “Check Variable Names”
If you’re on MacOS, and use the Monkeybread (a.k.a. MBS) plug-in with “check variable names” enabled, you quickly come to appreciate how useful this feature, also known as linting, can be.
For example I recently helped another developer track down a script problem that turned out to be a slight misspelling of a variable name, a misspelling subtle enough that it took us a long time to see it (of course for most of that time we didn’t realize the $var name was the culprit). If he’d had Monkeybread installed and this feature turned on, we’d have saved about 45 minutes. Actually I shouldn’t say “we”… my colleague would have immediately seen the problem and wouldn’t have bothered to contact me.
Here’s how it works: when MBS sees a $var it doesn’t recognize, or a $var that appears before it has been declared, the $var will be flagged in red like so.
Ideally, any time you see an error like this, you don’t ignore it — you know there’s a problem and you need to fix it. However, while this feature works great with explicitly declared $variables (created via Set Variable)…
…it does not recognize implicitly declared $variables (created via some other method), for example…
- As input $vars for Show Custom Dialog
- As the target for many of the “Insert” script steps
- Via Let, either directly or from within a custom function
…and as a result some developers either don’t use MBS linting, or perhaps they do use it but don’t take it completely seriously because it “cries wolf” too often, as per this screen shot.
Well it turns out there’s an easy way to tell MBS about implicit $vars; simply add a comment at the top of your script with the implicit $var names like so.
Note 1: in MBS 15.0 and earlier you need to ensure there is no space between the # and the @ — according to a reliable source this may change in an upcoming version of the plug-in.
Note 2. As per this documentation on the MBS web site, @variable, @parameter, @constant, @param or @const can be used instead of @var if you prefer.
Note 3. You can also place each $var on its own line like so if you wish. (I don’t know why you would; seems like a waste of time and pixels to me but don’t let that stop you if you are so inclined.)
I wrote to Christian at MBS to ask about the multiple $vars on one line feature and he pointed out that you can separate $var names with a comma, e.g,
…and that you can learn more about checking variable names here — https://www.monkeybreadsoftware.com/filemaker/SyntaxColoring/12-Checkvariables.shtml