My Favorite Features in the MBS Plugin

20 years of the MBS FileMaker Plugin—that’s quite an impressive time span. For two decades, the plugin has been enhancing FileMaker with features that go far beyond what’s possible with the platform’s built-in tools. I’ve been working at MBS since 2019 and, since then, of course have also been working with the MBS FileMaker Plugin. During this time, I’ve discovered, tested, and used countless features in FileMaker projects. Some of them are little helpers that save a lot of work in everyday tasks. Others open up possibilities that you might not have even thought were possible without the plugin. To mark the 20th anniversary, I’d like to share a few of my personal favorite features that have guided me on my journey as a developer.
DynaPDF: Combining PDFs and Adding Page Numbers
Let’s start with a few features from the DynaPDF topic, because that’s where I started. With DynaPDF, you can handle a wide range of PDF-related tasks. I wrote my first article in the German FileMaker Magazine in 2019 on the topic of combining PDFs and inserting page numbers. First, I imported all the PDF files one after another into the working environment using DynaPDF.ImportPDFFile, and then, in a second loop, I wrote the page numbers onto the pages using DynaPDF.WriteFTextEx.

Goodies

The features I use most in our plugin are, of course, the Goodies, as is probably the case for most of you. These free tools have been making life a little easier for Mac developers for years. Often, these little helpers are no longer even noticeable in everyday use because we’ve become so comfortable with them that they seem like a standard feature. Whether it’s automatic variable checking, syntax highlighting, or searching within scripts. A new feature has just been added this year, that Windows users will also appreciate. A search across all scripts. You can now perform searches using a variety of search options, and the results are displayed in a window showing script names and line numbers, so that you can, for example, make changes to a global variable one by one as you go through the list—across all scripts.
GraphicsMagick

The first MBS Advent calendar published on this blog in 2022 focused on GraphicsMagick. With GraphicsMagick, you can edit images, crop them, resize them, convert them, and much more. What I remember most from that Advent calendar was the 24th entry, where we turned a square image into a round one. Of course, the image wasn’t actually round, but it appears that way because we made everything outside the circle transparent. The trick was to use an image with a black circle as a mask and then use the GMImage.CompositeXY function to set the unwanted pixels to transparent.
Set Variable [ $r ; Value: MBS( "GMImage.CompositeXY"; $Cut; $GM; 0; 0 ; 2 ) ]
You're welcome to read more about how we made it back then in Door 24 of our Advent calendar.
Barcodes
One of my favorite things in our plugin is barcodes, and that’s probably because they have such an incredibly wide range of applications. Whether in postal mail, on business cards, invoices, or on any product in the supermarket, with the plugin you can generate over 90 different barcodes and read over 10 different barcode types. Because, as you’ll learn later, I’m a big fan of JSON, the Barcode.DetectAsJSON and Barcode.GenerateJSON functions are some of my favorites. Barcode.DetectAsJSON returns all barcodes detected in an image in a JSON. In addition to the content and type, you’ll also receive a bunch of other information.
[
{
"format": "UPC-E",
"text": "11234562",
"isValid": true,
"ecLevel": "",
"contentType": "Text",
"hasECI": false,
"orientation": 0,
"isMirrored": false,
"isInverted": false,
"version": "",
"sequenceId": "",
"sequenceSize": -1,
"sequenceIndex": -1,
"symbologyIdentifier": "]E0",
"isLastInSequence": false,
"isPartOfSequence": false,
"lineCount": 60,
"position": {
"topLeft": {
"x": 20,
"y": 0
},
"topRight": {
"x": 121,
"y": 0
},
"bottomLeft": {
"x": 20,
"y": 59
},
"bottomRight": {
"x": 121,
"y": 59
}
},
"bytes": [49, 49, 50, 51, 52, 53, 54, 50]
}
]

The Barcode.GenerateJSON function, on the other hand, takes a JSON object as input that contains all the information needed to generate the barcode. This allows you to specify all the settings in a single JSON object. Settings for which you previously had to call a separate function for each one. This makes working with barcodes even easier.
Set Variable [ $img ; Value: MBS( "Barcode.GenerateJSON";
"{\"Symbology\": \"QRCode\", \"Text\": \"Hello World\",
\"Scale\": 4, \"BorderWidth\": 4}") ]
If [ MBS("IsError") = 0 ]
Set Variable [ $r ; Value:
MBS( "GMImage.WriteToPNGContainer"; $img; "Barcode.png") ]
Set Field [ Barcode::Barcode ; $r ]
Set Variable [ $r ; Value: MBS( "GMImage.Release"; $img ) ]
End If
JSON
Even back in university, I was fascinated by the possibilities JSON offers for communicating with APIs. FileMaker already provides some great built-in functions for working with JSON. But if you want to build your own JSON or need more advanced functionality, the MBS FileMaker Plugin is here to help. I’d like to take a closer look at one function that’s particularly powerful in this area: JSON.Query. This function works with JSON Path, which opens up a wide range of query possibilities. This means we can not only navigate to a specific point in our JSON using dot notation, but we can also formulate conditions to effectively filter our JSON based on specific criteria.
For example, suppose you have this JSON:
{
"persons": [
{
"name": "Juchmes",
"firstName": "Stefanie",
"hobbies": ["programming", "reading", "photography"],
"dog": {
"name": "Bella",
"age": 6,
"LikeTreats": true
}
},
{
"name": "Miller",
"firstName": "Jon",
"hobbies": ["cooking", "writing", "watching movies"],
"dog": {
"name": "Ruby",
"age": 2,
"LikeTreats": true
}
}
]
}
We want to find the name of the person who has a dog named Ruby; you can easily do this in a single query using JSON Path.
Set Variable [ $res ; Value: MBS("JSON.Query"; $JSON;
"$.persons[?(@.dog.name=='Ruby')].name"; 0) ]
The $ symbol represents the root element of our JSON; from there, we navigate to the “persons” key. This key contains an array of objects. So first, we need to find the object that belongs to the owner who has a dog named Ruby. To do this, we need to include a condition in our path. This condition is introduced by the question mark. The path to the dog’s name follows in round brackets. The @ symbol indicates the position we’re currently at in the JSON and from which we’ll move on. To compare, we use the == operator and set the value to Ruby. This selects the object belonging to that owner. Now let’s move on to the owner’s name.
If we run this line of script with the JSON, we’ll get an array containing the name “Miller.” If there were multiple owners who have a dog named Ruby, their names would now be listed here, separated by commas.



