« Background Color for … | Home | News from the MBS Xoj… »

New in the MBS FileMaker Plugin 10.1

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

JavaScript
In the last plugin version we introduce the new JavaScript component. With those functions it is possible to use JavaScript without the help of a web viewer. In this version we have added some features, that simplify the work with JavaScript functions.

Times and dates in JavaScript are passed as floating pointer numbers. The function “JS.Now” returns us the number of milliseconds since the 1st January 1970. So we can determine the current time in combination with the “JS.TimeToDateComponents” function. This function returns us a JSON object with the individual specifications like year, month, day, hours, minutes, seconds, milliseconds, weekday, timezone and weekday

Here you see an example script:
Set Variable [ $JS ; Value: MBS( "JS.New" ) ]
Set Variable [ $time ; Value: MBS("JS.Now";$JS) ]
Set Variable [ $Res ; Value: MBS( "JS.TimeToDateComponents"; $JS;$time) ]
Set Variable [ $r ; Value: MBS( "JS.Free";$JS ) ]


If you combine this function with the “JS.UTCDateToTime” function you can get such a JSON of a FileMaker timestamp. “JS.UTCDateToTime” convert a FileMaker timestamp to the time format that the function “JS.Now” uses. Additionally there is a function that converts the millisecond output back to a FileMaker readable timestamp. This function is called JS.TimeToUTCDate.



We have also added counting functions that count the number of objects and global strings. In an empty JavaScript environment there are already about 1000 strings and about 400 objects. So if you want to find out how many objects and strings are added, you have to subtract the basic amounts.

CURL
We also offer you a new curl function. With “CURL.Features” you queries the features in the CURL library in use. The information about enabled features the function returns as JSON.

GMImage
We would also like to introduce the new features of the GraphicsMagick component. We can use the function GMImage.ExifThumbnail to read a thumbnail from the Exif data. We also get the active font mapping from the GMImage.FontMap function as XML text. So you can see which fonts you can use when adding text to an image.

XL.Uninitialize
Users of the XL component, that makes it possible to work with Excel spreadsheets, can now enjoy a new function. The XL.Uninitialize function, releases all objects, function pointers and the library only by one function.
You call this if you like to replace the library file and load another version.

SharedMemory
Also this time the new plugin version provides new components, including the SharedMemory component. With this component you can exchange data between processes. So they can create data with SharedMemory.SetValue in one process, which can then be read by the second process with SharedMemory.GetValue. For example, you can work with two applications in two versions of FileMaker or run two server processes and you can exchange data. The content is only lost when the computer is restarted and in this case you can work with the data even if the application quit between writing and reading value. In addition, you can use the function SharedMemory.Exists to determine whether data was stored in shared memory.

POST requests via WebViewer
With the new function “WebView.PostURL” you can send a POST request. This way you can send information, forms or files to the server. You can also transfer large amounts of data such as images. The post data that is sent to the server is part of a HTTP POST transaction. A POST transaction is typically used to send data gathered by an HTML form. If the parameter with the Post data is empty this method issues an HTTP GET transaction. The Post data in this function is ignored, if the URL is not an HTTP URL. In this way the function work similar like the “WebView.LoadURL” function.

The best thing here is that you pass custom header. When you have a website complaining about FileMaker using Internet Explorer, you can pass a User-Agent claiming you are Firefox or Google Chrome and the website may let you in.

Menu, Menu items and contextual menus
If you use multiple menus and menu items in your solutions it can become confusing. We have now developed a function that gives you a list of all existing menus (Menu.List) and menu items (MenuItem.List). In this lists you will find the IDs of the menus and menu items. So we can find out how many menus and menu items are in our solution and loop over entries after creating them via Menu.DefineQuickMenu function.

With the new functions FM.SetDisableContextualMenus you can enable and disable context menu for all of FileMaker. You may want to use the layout trigger to disable menus when entering a layout and enable it when we leaving that layout. With the matching function FM.GetDisableContextualMenus you can also query this status.

Geo coordinates for us
Also new is the the Proj component. With this component you can transform geo coordinates between projections with the PROJ library. After the inizilaization (Proj.Initialize) you can transform one coordinate (Proj.Transform) or several coordinates (Proj.BatchTransform). You can specify the coordinates in the parameters. Multiple coordinates are passed as JSON with the keys x, y, z.

The component CLGeocoder for Mac gets a new very interesting function. The “CLGeocoder.JSON” function gives us additional information for a Geocoder in a JSON block. So you create a Geocoder with an address (“CLGeocoder.GeocodeAddressString”) or coordinates (“CLGeocoder.ReverseGeocodeLocation”). These two functions have also a new parameter which we want to use in connection with the “CLGeocoder.JSON” function. This parameter decides whether the program waits until the calculation of the coordinates or the address has been completed or whether it continues while the calculation is running and the data can be requested later. For example, the “CLGeocoder.JSON” function follows directly after the geo coder is created, so it is necessary to wait for the results. In the picture you see the output of these scripts.

Set Variable [ $geo ; Value: MBS( "CLGeocoder.GeocodeAddressString"; "Pariser Platz 5 10117 Berlin Germany"; 1 ) ]
Set Variable [ $JSON ; Value: MBS( "CLGeocoder.JSON";$geo) ]
Show Custom Dialog [ "CLGeocoder.JSON" ; $JSON ]


New functions for Mac users
The MBS Plugin in version 10.1 offers some more new features for Mac users.

Fresh wind at Script Workspace
The little helpers for developers under Mac OS have some new features. You can now choose a custom font and font size to display the Script Workspace. You can also customize the font of the Script Workspace and the calculation dialogs that they suit your needs.



With two more new functions, you can put the text at the current script into the clipboard (ScriptWorkspace.CopyScriptText) or query the text to save it into a field. With the second function we can choose between different formats to display our output. We can choose between styled text, plain text, html or rtf. These functions can be very useful to post your script text e.g. in a forum or your blog.

Lets play with contacts
There are additional improvements in the functions that use the Apple Address Book. With the function "CNContactPicker.Show" you can show a popup window in which your contacts are listed. You can set your own script trigger ("CNContactPicker.SetTrigger"), whose script is started when a contact is clicked. It is a useful option to query the ID of the clicked contact. You can do this with the “CNContactPicker.Current" function in the script trigger script. Then you can use the delivered contact ID to e.g. delete single values of a contact with the new function "CNContact.DeleteValue". To do this, enter the desired category from which the value should be deleted. For example, you can delete the birthday of a contact with MBS( "CNContact.DeleteValue"; $contactID; "birthday"). Under iOS you can use the new function "CNContact.Show" to display a contact as a card. You can then edit the contact using the displayed buttons.

Set the idle timer in iOS
At next I want to introduce two new functions for iOS to be used with FileMaker iOS SDK. With the new function "iOSApp.SetIdleTimerDisabled" you can switch the idle timer on and off, so that your app doesn't go into sleep mode if you don't use the display for a while. When using this function you should take care that a permanent active screen results in a high energy consumption, therefore it only makes sense to switch off the idle timer permanently in your app after considering all points. You can query the idle status with the function "iOSApp.GetIdleTimerDisabled".

New functions for Windows users
Last but not least I want to introduce the new functions for Windows users.

Signing PDFs with WinCrypt and DynaPDF
In the DynaPDF component you will find two new functions to sign files with WinCrypt and DynaPDF. In the parameters you make the settings for the function. Optionally you can also show a dialog where you can make further settings

WMFP
The component Windows Media Foundation Player that was added in the last version play audio and video independent of a container field. In this version we have added more features to this component. You can use the new function "WMFP.SetLoop" to determine if the content of the player should be repeated automatically. You can enable and disable this loop. The associated function "WMFP.GetLoop" provides us the current status of the player. So you can check if the loop is activated. another new function is "WMFP.Screenshot". This function queries a picture from current frame.

We hope you will also find some interesting new features. We wish you a lot of fun with MBS FileMaker Plugin Version 10.1. If you need a license or you have any questions, please contact us.
By Stefanie Juchmes
17 03 20 - 14:43