In this article I want to introduce you the new functions from the MBS FileMaker Plugin in version 10.4.
Let's start with the changes in the CURL component. Here are some new functions that give us information about CURL connections. With the function CURL.GetOptionURL we get the value of the current URL. The function CURL.GetOptionCustomRequest queries current custom request value and with the CURL.GetOptionPostFields function you can get the current post fields values. The function CURL.GetOptionUserName returns the name of the current user.
You can also use the CURL.GetRetryAfter function to query the Retry-After retry delay time you get from the header. This time tells you in how many seconds you can expect the next retry from the server.
Another new function is CURL.GetEffectiveMethod. This function returns the last used effective HTTP method
The SSH.ConfigureKeepAlive function enables or disables sending KeepAlive messages over a SSH connection. In the parameters you can specify how often KeepAlive message are sent. Please specify how many seconds to wait before sending a keep alive message. If a zero is entered here, the sending of KeepAlive messages is disabled.
We also have a new feature in our JSON component. With JSON.GetArrayItems you can return the elements of a JSON array as a list of reference numbers. For large arrays the MBS function is faster than the FileMaker own functions.
Trace functions are an incredibly useful tool for error analysis. They register all plugin calls in a log file. With the new functions you can also log the individual threads on the server. You specify the path where the logs should be stored. We suggest to use /tmp folder as this gets cleaned on server restart, but FileMaker's log folder may also work. The function Trace.SetServerLogPath allows you to specify the folder and get one file per thread running a script. You can also query the location of these log files with Trace.GetServerLogPath.
Load the IconvLibrary explicit
The new Plugin.LoadIconvLibrary function loads the iconv library.
Some plugin parts like Archive functions can make use of libiconv for text encoding conversion.
If you explicitly need, you can load the library on start of solution.
MBS FileMaker Plugin may try to load iconv.dll/dylib/so automatically on the first time an iconv function is called. For this reason, the function must only be called in exceptional cases, otherwise the loading is automated.
Extract a specific file from an archive
With the new function Archive.ExtractFile you can extract a file from a given archive. The result is a container value, which you can store e.g. in your database. We specify the file that should extracted, together with the path to the archive in the parameters. This function can help you to automate even more processes in your daily work.
We have some new functions in the component GraphicsMagick with which we have more possibilities to write texts in and on graphics. So they can set the FontFamily with the new function GMImage.SetFontFamily. With GMImage.SetFontStyle we can add the style. This can be Normal, Italic, Oblique or Any. You can also specify the font weight with the GMImage.SetFontWeight function. Values from 0 to 1000 can be chosen. A value of 400 corresponds to normal font weight, a value of 800 is a bold font. Also the character spacing can be influenced. With GMImage.SetFontStretch you can choose between Normal, UltraCondensed, ExtraCondensed, Condensed, SemiCondensed, SemiExpanded, Expanded, ExtraExpanded, UltraExpanded or Any.
The use of these functions can then look as follows:
Set Variable [ $ref ; Value: MBS( "GMImage.NewFromContainer"; Textfield::Image ) ]
Set Variable [ $r ; Value: MBS("GMImage.SetFontPointsize"; $ref; 80) ]
Set Variable [ $r ; Value: MBS( "GMImage.SetFillColor"; $ref; "red" ) ]
Set Variable [ $r ; Value: MBS("GMImage.SetFontStyle"; $ref; "Italic") ]
Set Variable [ $r ; Value: MBS("GMImage.SetFontFamily"; $ref; "Arial") ]
Set Variable [ $r ; Value: MBS("GMImage.SetFontStretch"; $ref; "Normal") ]
Set Variable [ $r ; Value: MBS("GMImage.SetFontWeight"; $ref; 800) ]
Set Variable [ $r ; Value: MBS("GMImage.Annotate"; $ref; "Hello World") ]
Set Field [ Textfield::IMGResult ; MBS( "GMImage.WriteToPNGContainer"; $ref ) ]
Of course there are also reverse functions of all these functions to query the set values.
Two other new functions give us helpful information. First, we can use GMImage.MagickVersion to query the used version of the GraphicsMagick library and second, we can get a list of all fonts with the GMImage.ListTypeInfo function as a written file. For this we pass the function the target path.
Filter ASCII text
The new Text.FilterASCII function filters out all characters that do not fit into an ASCII text, e.g. emojis that are larger than 7bit. This is important for values entered in programs that do not support characters outside the ASCII range.
There are also new features for Mac and the iOS SDK.
You can now also insert styled text per script in a TextView, e.g. from an existing text field. In addition TextView.AppendStyledText allows you to add styled text to the text in a TextView. With TextView.GetStyledText you can also read out styled text and save it e.g. in a text field.
There are also news from the ImageCapture component. For a while now you can connect your SLR camera, which supports ImageCapture, to your Mac and use the ImageCapture functions to capture images and display them directly on your computer display. This offers the advantage that you can view the image on a large screen and process it directly. With the new function ImageCapture.SetItemsAddedScript you can define a script that is called when an image is captured. For example, you can trigger a script that displays the image enlarged, saves it to a file or edit it with functions from GraphicsMagick component.
Also the ListDialog component has got two new interesting functions. For a long time till now you have been able to display a list in a dialog and query the input of one or more list elements, but now you can alternately color the row background. This means you can better distinguish between the individual list rows. To activate this coloring, use the function ListDialog.SetUsesAlternatingRowBackgroundColors and enter 1 in the parameters. If you want the background of the list elements to be completely white again, call the function again and enter a 0 instead of a 1. You can also query the status of this setting with ListDialog.GetUsesAlternatingRowBackgroundColors.
With the new function iOSApp.ReadReceipt you can read and parse receipts from the App Store.You can specify a path of an app in the parameters from which the invoice data is requested. If we do not enter a path, the billing data of the current app will be queried. The returned result is a JSON text with information. This can look like this:
"expirationDate" : null,
"inAppPurchases" : [
"bundleIdentifier" : "com.test.test",
"appVersion" : "16.0",
"opaqueValue" : "JZ1gFXm34qI+cdiUV0jVow==",
"originalAppVersion" : "13.1",
"receiptHash" : "Xm1\/u8I3vf45PTt6UR7p1U0Q15M=",
"purchaseDate" : "2020-04-16 13:44:32 +0000",
"bundleIdentifierData" : "Y29tLnRlc3QudGVzdA==",
"creationDate" : "2020-08-22 08:39:20 +0000",
"transactionDate" : "2020-08-22 08:39:20 +0000"
There are also news for Windows users
Visual Studio 2019
The main feature of the newer plugin version for windows user is our move from Visual Studio 2008 to the current version 2019. We now use universal runtime library, the same Visual Studio runtime as FileMaker. As Windows 10 includes those DLLs by default and Windows 7 and 8 can install them, the plugin should run fine there. We worked on this for over a year to get all our libraries ported and recompiled. All parts come together and we can finally ship our Windows plugins built with current tools and start to add more Windows 10 APIs over time.
You can already use one of these new possibilities. For years now we have a function for Mac that can query where the machine that calls this function is currently located. Such functionalities are now available for Windows too. For example, you can determine where your Windows tablets are currently located to provide faster and more targeted support.
First we have to initialize the Location functions with WindowsLocation.Initialize. Because the location of a computer is a data security issue, we first have to ask, with the WindowsLocation.RequestPermissions function, the user for permission to use this functionality. It opens a system dialog box to request user permission to enable location devices. With function WindowsLocation.Status we can then query the status of this permission. These are the possible results: Not supported, Error, Access Denied, Initializing and Running. If we get Running as result we use WindowsLocation.Location to request the position of the device. In response we get a JSON in the longitude and latitude as well as the altitude above sea level. We also get information about the accuracy of this informations, the time of the query as timestamp and the sensor number. So a result could look like this:
"Timestamp": "7/30/2020 1:47:15 PM"
We hope you will also find some interesting new features. We wish you a lot of fun with MBS FileMaker Plugin Version 10.4. If you need a license or have any questions, please contact us.
by Stefanie Juchmes