Goodies 24: Auto Complete variables and functions

For a couple of years we do various things in FileMaker Script Workspace like syntax coloring. We got a copy command once we started to read all lines in a script. Later we added checks to find usage of undeclared variables, so you easier spot typos in your variable names. Now we go one step further: We scan for variables and present you a list of names we know.

When you have a script open in the Script Workspace and you open a calculation dialog, you can now auto complete. Just go into a calculation dialog for a Set Variable or Set Field or any of the other script steps taking a calculation. Then type something. We have a switch there, so only when you type a $ symbol, our plugin activates. Otherwise it lets the request pass to FileMaker to auto complete field and function names.

We auto complete all $ and $$ variables defined in the script. If you use Let() statement, we also recognize $, $$, ~, _ and ¢ variables defined in the text above the current cursor position.

For custom functions or specify output file dialog, you need to manually trigger auto complete. This seems to happen with Option-ESC shortcut on macOS Sonoma and with F5 in older versions (if dictation is off).

To find the variable names, we scan the script from the current selected line for currently up to 500 lines upwards. The limit can be adjusted with SyntaxColoring.CheckVariableDeclaration.SetLimits function if needed. We hope that is for now enough to find the common variable names you like to use. If you keep working in one script workspace, we retain global variable names, we see, so you may see them in auto complete for multiple scripts.

Like with the variable check, we support declaring variables in comment lines. That is a kind of workaround for the plugin not seeing into global variables list from FileMaker or parsing Let statements. You can define comments with a prefix @variable, @parameter or @constant or actually shorter with @var, @param and @const if you prefer. The plugin will notice them and use them for variable name checking as well as auto complete. If you use common global variables in the script, you may just declare them on the top as a comment:

# This script uses the following global variables, initialized in our start script:
# @variable $$UserName
# @variable $$WebServiceAuth

This feature was developed on the weekend of 27th/28th November 2021 and a bit tuned in the following week. We also got a command for the context menu to copy the list of variables defined in a script.

MBS functions

Our plugin can do auto completion of MBS function calls. Just type the component name and once you got the right one, maybe with cursor down key, you can press the dot to complete. Then you continue to type and a new auto complete list shows the function names:

Once you got function name and there is not much text following, the MBS FileMaker Plugin will add the parameter names as placeholders. You can directly put in variables with same name or enter some value there.

Available or recent FileMaker versions on macOS in MBS FileMaker Plugin 12.1 or newer.


Sort Scripts 24 Add/Remove table occurrences