In this article we want to introduce you the new functions from the MBS FileMaker Plugin in version 13.1.
With the new functions of the Archive component you can easily create your own archives. First, you create a new archive with the Archive.Create function. In this function you define the format in which your archive should be written. The following formats are available: 7zip, ar, arbsd, argnu, arsvr4, bsdtar, cd9660, cpio, gnutar, iso, iso9660, mtree, mtree-classic, newc, odc, oldtar, pax, paxr, posix, raw, rpax, shar, shardump, ustar, v7tar, v7, warc, xar and zip. Then we have to choose a filter that fits the format. Optionally, we can then specify a storage location with a file path. You can pass specific information about a format in further parameters and specify a password for the archive, which must be entered by the user when opening it. You can then use the Archive.AddFile, Archive.AddText and Archive.AddContainer functions to add the appropriate files to this archive. When you are done, close with Archive.Close. If we expect a container value back it will be in the output of this function. For a file that has been saved on disk, we get an OK. Here we see a script in which first the zip archive is created and then a text file, a file from a container and two files from a folder are added to the archive. After that the archive is closed again and stored on the desktop.
Set Variable [ $Path ; Value: MBS("Path.AddPathComponent"; MBS("Folders.UserDesktop"); "abc.zip") ] Set Variable [ $r ; Value: MBS("Archive.Create"; "zip"; "deflate"; $Path; ""; "Hello") ] Set Variable [ $r ; Value: MBS( "Archive.AddText"; "Hello World"; "UTF-8"; "Hello.txt" ) ] Set Variable [ $r ; Value: MBS( "Archive.AddContainer"; Tabelle::Container ; "Image.png" ) ] Set Variable [ $r ; Value: MBS("Archive.AddFile"; "a.png¶b.pdf"; MBS("Path.AddPathComponent"; MBS("Folders.UserDesktop"); "testA")) ] Set Variable [ $r ; Value: MBS("Archive.Close") ]
The new functions from the MongoDB component should make your work with Mongo DB much easier. We added aggregate functions for you to query data by applying a filter, sorting rules and grouping either to the whole database or only to a specific collection. Also, we can query the TLS status of the database to see if it is encrypted. With the function MongoDB.GetOptions we can query the options from the URL as a JSON document.
There are also new functions in the XL section, which allows you to read and write Excel documents without having Excel installed. We have 45 new functions for handling form controls. Here you can see a list of the new functions. Feel free to try them out.
We also have a few other new features. For example you can test with the new XL.Book.IsWriteProtected function if a workbook is readonly before an error occurs if you want to write to Celle here. You can also determine and set the default Row Hight. Even the marking of cells has changed a lot. So you can also set a cell to active with the new function XL.Sheet.SetActiveCell. In the parameters we specify the wookbook, the sheet index and row and column index.
Also in the DynaPDF area we have news. First we have a new function with which we can rename named destinations in a PDF. For this you can now use the DynaPDF.ChangeNamedDest.
Since version 4.4 we have already included the function DynaPDF.CreateStructureTree in the plugin. This function creates a global structure tree that is required to create Tagged PDF files. With the new function DynaPDF.CreateStructureTreeEx we can now additionally specify the type of root tag. This can be type, div, document, part or sect. In all other details the functions work identically.
We can now use the two functions DynaPDF.SaveAndSignFileExt1 and DynaPDF.SaveAndSignFileExt2 to sign a PDF with an external PKCS7 signature provider. After the DynaPDF.SaveAndSignFileExt1 function has returned you a hash to sign, you can pass in DynaPDF.SaveAndSignFileExt2 the signature to close and finish the PDF file.
DynaPDF now also supports writing PDF/UA-1 files.
With the new function PKCS12.SignData you can now also create a PKCS#7 signature to given data. In the parameters you first specify the PKCS12 reference, then the input type, which can be text, container, image, path, PDF, data, base64 or hex. This is followed by the input data and the encoding. We also specify in which form we want to get our result back. Optionally, we can specify information about a specific input type. For example, we can specify the encoding for an output text.
There is also news in the audit component. Here we have the new function Audit.BaseTableNameForID which finds the base table name from the cache for a given table occurrence ID. We specify the table ID as a parameter.
MBS( "Audit.BaseTableNameForID"; 1065089 )
So that the plugin works properly on your computer and in case of problems, the error can be found faster, we have integrated since the plugins exist a component in the plugin that contains these small auxiliary functions. This component gets two new functions with this update. With the function Plugin.IsMaintenanceExpired you can check if the maintenace for the plugin has expired. If you want to find out what the current state of the plugin is, you can query it with the Plugin.State function. This can return you one of these possible results:
- Trial for a trial license
- Free for the free tier when no function was used that needs a license Licensed if a valid license is put in
- Expired if a valid license is put in, but the maintenance is expired
- Demo if no license is set and you used functions, that require one
- Dead if demo mode was run too long
Convert data types
We have one more cool little thing for the users of all platforms. You can convert data types with the function FM.TextWithDataType. In the function we enter e.g. a numberString, specify the desired type and get back a numeric value, with which we can work then. If you want to know the data type of a value, you can also use our FM.DataType function which returns the data type.
Set Variable [ $old ; Value: "123" ] Set Variable [ $new ; Value: MBS( "FM.TextWithDataType"; $old; "Number" ) ] Show Custom Dialog [ ""Change Data Type" ; "Old: " & $old & "¶Datatyp: " & MBS("FM.DataType"; $old) & "¶¶New: " & $new & "¶Datatyp: "& MBS("FM.DataType"; $new) ]
New functions for Mac and iOS
The MBS FileMaker Plugin in version 13.1 offer some more new functions for Mac and iOS users.
The ContinuityCamera section has two new functions. We can use the function ContinuityCamera.CanImport before an import to determine whether the functionalities of the Continuty Camera can be used at all. We can use this function for example to hide a button that causes the import with Continuity Camera. The second new function is the ContinuityCamera.HasPopupMenu function. This checks if the popup menu for the Continutycamera import can be displayed.
Regular expressions in script search
For years we have been supporting developers with our free script goodies, which should make working with scripts much easier. This time we have made an improvement of the search in the script area. Now you can search here not only with fixed texts, but also with regular expressions. For example, in the image you can see a regular expression that returns all variables that start with an a and also contain an e somewhere. This makes it possible for you to formulate even more precise searches.
Swipe gestures for iOS
For iOS there is now the iOSApp.AddSwipeGestureRecognizer function that allows you to capture swipe gestures. You can set a script that will be triggered when the plugin detects a swipe gesture. This way we can react to these gestures and change the layout for example. Matching to this we have the iOSApp.ClearSwipeGestureRecognizer function which removes the activation of the script, so that the script is no longer triggered by a swipe gesture.
There is also new gerate functionality for Windows
Did you know that Windows 10 has an OCR engine integrated? We have now made this available for you with the plugin. In the new component WindowsOCR you will now find 15 new functions that support you to recognize text from images. With the function WindowsOCR.Available you can first check if your Windows can use the OCR functionality. If this function returns 1 you can start. After you have created a new OCR instance with WindowsOCR.New you can read an image from a container or a file with the appropriate recognition functions. You can then read your result as text (WindowsOCR.Text) or as JSON (WindowsOCR.Result). The other functions support you additionally in your work. If you want to learn more about this topic, please have a look at our blog article OCR on Windows in FileMaker.
Windows User Notification
For the WindowsUserNotification component we have some new Get and Set functions for you. For the Set function presented here there is also a matching Get function.
The funktion WindowsUserNotification.SetExpiresOnReboot sets whether the toast notification will remain in the Notification Center after a reboot.
With the function WindowsUserNotification.SetNotificationMirroring we sets a value that specifies whether notification mirroring is allowed.
The function WindowsUserNotification.SetSuppressPopup sets whether a toast's pop-up UI is displayed on the user's screen.The default value is 0, meaning the toast's pop-up message will be shown. Setting this property to true places the toast notification silently into the action center. This enables your app to communicate with the user without interrupting them.
If we want to set the Group or the Priority for a notification we can use the functions WindowsUserNotification.SetGroup and WindowsUserNotification.SetPriority.
WindowsUserNotification.SetTag sets the unique identifier of this notification within the notification Group. With the function WindowsUserNotification.SetRemoteId we set a remote id for the notification that enables the system to correlate this notification with another one generated on another device.
Also we have a new feature that gives us a list of all IDs of notifications.
Small helpful new functions
In every release we also include functions that are not so spectacular, but that make things easier for individual developers.
WebView.GetZoom gives you the current zoom factor. This function works in FileMaker 19.4 in web viewers that use Edge.
We hope you will also find some interesting new features. We wish you a lot of fun with MBS FileMaker Plugin Version 13.1. If you need a license or have any questions, please contact us.