New in MBS FileMaker Plugin 12.1

In this article we want to introduce you the new functions from the MBS FileMaker Plugin in version 12.1.

WebHook

We already introduced the new WebHook component in the release 11.5. In the new release we provide a few new functions that should make your work with WebHooks easier. With the function WebHook.SetMaximumRequestSize we set the maximum allowed request size. This allows you to disconnect sockets, which send too much data. By default there is no limit, so people can send requests with several gigabytes of payload. Depending on your use can it may be worth to limit request size to a reasonable value. For example if you receive notifications from your phone system, you may set the maximum size to 10000 bytes and a timeout of 60 seconds for WebHook.SetTimeOut function. That is probably 10 times more than needed, but may avoid some malicious user from sending a ton of useless traffic. Matching to this there is the WebHook.GetMaximumRequestSize function which queries this set value if needed. We can also get the size of a certain web request. WebRequest.GetSizereturns the total size of the request. The WebRequest.GetBodySize function then gives us the size of the body.

WebView

When you use custom web viewer with our plugin, you may run into the situation, that FileMaker rebuilds the layout (e.g. after changing a value list). But sometimes you want to prove if it was really rebuild or you must do it by your own. For that situation we got the function WebView.HasParent. It checks whether the WebView has a parent control. If this function return 0, you know the layout was rebuild and the custom web viewer is no longer visible. Otherway you can rebuild it. So when you have a script triggered by user going to new layout, you can check the status of web viewer and if needed rebuild it. Or change workflows, so if user needs to change a value list, they may need to open a card window then reach the edit dialog and when they click back button to close card, you can recreate the web viewer and load the content again.

Math

You want to calculate with FileMaker? Then I can recommend the new math functions. Calculate now the average, the maximum, minimum, the median, Sum, Standard Deviation and the Reciprocal with different numbers from a List. In the appropriate functions, you can specify a list of values that will be processed in the functions. Depending on the function, a single value or again a list is returned. With the function Math.Multiply we also have a function that can multiply the values of a list with a fixed value or with the entries of a second list. In the following example you can see the output of the functions for the always same list:

Audit

For the Audit area we have the new function Audit.Statistics. It queries statistics for Audit as JSON. You get the number of calls, fields and records, but also for the different error types like insert error or field type errors. If all things run normally the error counts are all zero. Additional we have the schema informations, how often we query the schema for tables, the schema for fields or related schema queries.

Files

With the new Files.AudioCoverArt function we can query the cover image of a file. You can retrieve the cover of MP3, MP4 and FLAC files. As return you will get an image as container value in JPEG, PNG, GIF or BMP format. The image format depends on which image is stored in the cover information. In the parameters of the function you can specify the file path where the file is located from which you want to retrieve the cover. Please note that the path must be a native path. If we have the file only as a FileMaker path, it can be easily converted with the Path.FileMakerPathToNativePath function.

Dictionary

We also have a new cool function in the Dictionary component. With the new Dictionary.Lookup function we query a value from the dictionary. If the key doesn't exist in the dictionary, we return the given default value instead of an error.

Plugin

The new function Plugin.GetFunctionParameters helps you if you need more information about the parameters of a plugin function. It gives you the metadata for the parameter list. In the function you can specify the function name and get a list of all parameter names.

Text

Sometimes you just have to look at things the other way around. The Text.Reverse function helps you to do this by writing a text from the bottom to the front, in other words, it completely reverses the order of the letters.

DynaPDF

There is also news from the Dyna PDF area. With the new function DynaPDF.SetSpaceWidthFactor you can now set the space width factor. The space width factor is used by DynaPDF.ExtractText to determine whether the distance between two text records or glyphs should be interpreted as space character. PDF files do often not contain space characters. Depending on the font type, i.e. fixed pitch or proportional fonts, different default widths are used during text extraction. However, the full space width is mostly too large to find spaces. Therefore, the text extraction algorithm multiplies the default space width with the space width factor to find suitable values.

Mac

There are also new features for Mac and the use of our plugin with the FileMaker iOS SDK:

Syntax help for your scripts

Already in the last release we introduced the autocompletion for variables in FileMaker. We have now extended the autocompletion to the function names of the MBS FileMaker Plugin. If you now want to write a MBS function in a formula dialog you will get the function names suggested. This selection list will be specified the more text you enter. Our function names always have a similar structure. First we write the component and then with a dot separated the actual name of the function. If you enter only the name of the component and a dot, you can see all the functions of a given component. If there are many, you can even scroll through the list. If you then confirm a name, the rest of the function is completed with placeholder parameter names, so that you can easily insert your own parameters without forgetting any.

We would now like to provide script colouring for texts as well. If you have a script text that you would like to colorize as the plugin displays it in the script area, the SyntaxColoring.ColorizeScript function can provide you with useful services. It will colorize your plain text.

Window

Two new cool functions are available for our Window functions. With the new function Window.SetCloseTrigger you can decide what should happen when a specific window or webviewer is closed. In the function you store on the one hand the reference of the window or webviewer and on the other hand information about the script that should be started when closing the referenced window. By the way, this script does not have to come from the same FM file in which the window was opened, but we can specify the file in the parameters. With the Window.ClearCloseTrigger function we can reset the script trigger and assign it to a new script if we want.

CNContact

Your contact may be from the picker and not have all fields loaded or it may be outdated and you like to get a fresh copy. The CNContactStore.FetchContact function takes an identifier and picks a fresh copy of the contact and returns a new reference. Then you can query values with CNContact.Value. This brings us to the new CNContact.HasValue function. With this function you can test if there is a specific information in a contact. So you can check with the contact identifier and the selector (e.g. nickname) if there is an information for the selector, for example if the contact has a nickname.

Continuity Camera

Do you want to prevent the displaying of the Continuity Camera function in your solution? Then the new function ContinuityCamera.SetEnabled will help you. With it you can control the displaying of this function in your context menus.

Dialog

Dialogs are incredibly important when communicating with the user. With the plugin you can forget about the boring standard dialogs and design your own dialogs, for example, by adding icons or extending its functionality by accepting and processing input from the user in fields without having to build a separate layout for it. In this release you will find two new functions from this area. With the Dialog.SetTextAlignment functions you can set the textaligment. No matter if left, center or right alligment. This is now up to you. With the matching Dialog.GetTextAlignment function you can also query the set value.

Printing

The plugin contains some helpful functions for Mac users that make your work with the printer easier. Also in this release we have a few new features for your printer. Sometimes you want to start from the very beginning. The PageSetupDialog.Reset function will do this for you when you do the Page Setup with the plugin. It brings the settings of the Page Setup back to the default state. Orientation, ScalingFactor, PaperWidth and PaperHeight are all set to -1. The option NoDialog is set to off. The PrinterName and PaperName are cleared. This way you can avoid that some options are set unintentionally. We offer a similar function for the Print Dialog. PrintDialog.Reset sets Copies, AllPages, FirstPage, LastPage, Orientation, Duplex, PageNumberingOffset, PrintStyleSetting, PrintTypePopupIndex, PrintTypeRadioIndex, ReverseOrder, PaperWidth, PaperHeight all to -1. NoDialog, PrintToPDF, Reset and FixDestination is set to off. PrinterName, PaperName, Options, LastSettings, DestinationPath, Tray and LoadedSettings are cleared.

WinPhotoAcquire for Windows users

We have a new component in the plugin that may make the heart of Windows users beat faster. With the new component WinPhotoAcquire you can use the standard Windows dialogs to import image files. It works for digital cameras, scanners and many other devices. You can find more information about it in an extra blog article about the new component.
Article: Windows Photo Acquire for FileMaker

Please do not hesitate to contact us if you have questions.

by Stefanie Juchmes

A beginner question...

If you have the plugin, add pictures to the Dialogs, does the user need the plugin installed?

For the most flexible dialog, you may just use a FileMaker layout to define the content of the dialog.

We do have some dialog functions, but those have no images, beside maybe the ProgressDialog functions.

1 Like