11 hours ago11 hr In this article we want to introduce you the new functions from the MBS FileMaker Plugin in version 16.1.LlamaAI is all the rage, and we're working to make as much of this technology available to you as we can. With Llama, we've added a new component to the plugin. This component provides functions that let you use a local LLM on your computer. This way, you can download a model, use it locally, and query it in a chat. You can learn more about how this works in our blog post Use Llama.cpp in FileMaker.JSONThere are new features in the JSON section. For example, you can use the EnvironmentVariables.JSON function to display all environment variables from your operating system. An example for macOS might look like this:{ "USER": "cs", "COMMAND_MODE": "unix2003", "__CFBundleIdentifier": "com.filemaker.client.pro12", "PATH": "/usr/bin:/bin:/usr/sbin:/sbin", "LOGNAME": "cs", "SSH_AUTH_SOCK": "/private/tmp/com.apple.launchd.iXMjiPeWPN/Listeners", "HOME": "/Users/cs", "SHELL": "/bin/zsh", "TMPDIR": "/var/folders/xv/4dhqggss03gc5r26p68b9pgc0000gn/T/", "__CF_USER_TEXT_ENCODING": "0x1F5:0x0:0x0", "XPC_SERVICE_NAME": "application.com.filemaker.client.pro12.243918009.243918015", "XPC_FLAGS": "0x0" } The JSON.ToToon function is also new. It converts JSON to TOON. TOON stands for Token-Oriented Object Notation and is primarily used in the context of communication with AI. A conversion from JSON to TOON might look like this:For more information on TOON and the new function, see the blog post Introducing TOON and JSON.ToToon in the MBS FileMaker PluginPhidgetWe have added functions to the Phidget component that are essential for controlling LEDs. With the functions we have added, you can control LED arrays. Use the Phidget.SetLED function to set a single LED to the correct color at the correct location on the LED array by specifying the address and RGB color values in the parameters. If you want to set multiple LEDs on an LED array at once, use the Phidget.SetLEDs function. Here, you specify in the parameters, for example, the start and end addresses and the pattern you want. With Phidget.SetAnimation, you can also animate the LED array. A pattern can, for example, run across the array from left to right. You have the following options for moving the pattern: ForwardScroll, ReverseScroll, Randomize, ForwardScrollMirror or ReverseScrollMirror. If you have multiple animations, you can start them all simultaneously using Phidget.SynchronizeAnimations so that they run in sync. With the Phidget.StopAnimation function, you can disable the specified animation. The Phidget.ClearLEDs function turns off all LEDs in the array.FilesWe have added two new functions to the Files section. The Files.ApplicationPathWithBundleIdentifier function allows us to retrieve the path to an application by specifying the corresponding identifier in the parameters. It is possible that multiple applications have the same identifier. If you want to retrieve all paths, you can optionally specify a 1 in the parameters. You will then receive a list of all corresponding paths. Such a query might look like this:Set Variable [ $fm ; Value: MBS( "Files.ApplicationPathWithBundleIdentifier"; "com.filemaker.client.pro12"; 1 ) ] Show Custom Dialog [ "Path to FileMaker" ; $fm ] This feature works on macOS.The second new feature is the Files.OpenFiles function. It retrieves a list of open files from the FileMaker application. The list contains file paths for various files, such as open databases, open font files, various resource files for FileMaker or OS services, and, of course, temporary files.Insert and Update in DatabasesThere are two new functions in the Matrix section. The Matrix.InsertOrUpdateRecords function allows us to update information in a FileMaker table using a matrix. In the parameters of this function, we first specify the matrix containing the data we want to use to update the table. Then we specify the name of the FileMaker file that contains the table we want to work with; if we leave this parameter blank, the function will search all open FileMaker files for the appropriate table. We then also specify the name of the table. Next comes a list of the field names for the fields to be modified in the table. Finally, we specify which field name must be compared with which array index so that the entries in the array can be assigned to the individual records for the update.The situation is similar with the second function, Matrix.InsertOrUpdateRecordsToSQL, except that here we do not perform the update on a FileMaker database; instead, the update is performed via a connection to an SQL database. You can obtain a reference for such a connection from the SQL.NewConnection function, which you use to establish the connection to a database. With Matrix.InsertOrUpdateRecordsToSQL, we first specify the Matrix reference, then the SQL reference, followed by the table name and the fields. Finally, we again define the key field mapping. That might look like this:Set Variable [ $InsertFields ; Value: "Key¶TextField¶NumberField¶DateField¶TimeField¶ TimestampField¶ContainerField¶Description" ] Set Variable [ $result ; Value: MBS("Matrix.InsertOrUpdateRecordsToSQL"; $sql; $Connection; "Test"; $InsertFields; "Key=0") ] In the FM section, we have also added very similar functions: FM.SQL.InsertOrUpdateRecordsToSQL and FM.SQL.InsertOrUpdateRecords. The difference from the matrixfunctions is that, in this case, we do not have data in a matrix that we want to insert into a corresponding database; rather, the data to be inserted comes from an SQL query against our FileMaker database.# Load records into a stored SQL result and insert/update into other table Set Variable [ $SelectSQL ; Value: "SELECT PrimaryKey, TextField, NumberField, DateField, TimeField, TimestampField, ContainerField, Description FROM Source" ] Set Variable [ $InsertFields ; Value: "Key¶TextField¶NumberField¶DateField¶TimeField¶ TimestampField¶ContainerField¶Description" ] # Set Variable [ $sql ; Value: MBS("FM.SQL.Execute"; Get(FileName); $SelectSQL) ] # If [ MBS("IsError") ] Show Custom Dialog [ "Error: " & $sql ] Else Set Variable [ $result ; Value: MBS("FM.SQL.InsertOrUpdateRecords"; $sql; Get(FileName); "Dest"; $InsertFields; "Key=0") ] If [ MBS("IsError") ] Show Custom Dialog [ "Error: " & $result ] Else Show Custom Dialog [ "Records updated." ; $result ] End If End If # Set Variable [ $r ; Value: MBS("FM.SQL.Release"; $sql) ] OCRThere is also news in the OCR area. We have added a new feature that processes pages to render a PDF with embedded recognized text. The OCR.RenderPDF function is used to create a PDF from an image containing text. Here is an example:Set Variable [ $r ; Value: MBS( "OCR.Initialize"; $path; "eng") ] Set Variable [ $r ; Value: MBS( "OCR.SetImageFile"; "/Users/cs/Temp/eurotext.tif") ] Set Variable [ $r ; Value: MBS( "OCR.RenderPDF"; "/Users/cs/Temp/eurotext.pdf"; "Hello") ] Set Variable [ $r ; Value: MBS( "OCR.Cleanup") ] ThreadsThe new Process.SetQOSClass method allows you to set the Quality of Service class for a current thread. This tells the scheduler how to prioritize the thread and whether to run it on a faster or more efficient CPU core. You can choose from the following values:NameValueDescriptionQOS_CLASS_USER_INTERACTIVE5The thread handles user input.QOS_CLASS_USER_INITIATED4The user requested this action.QOS_CLASS_DEFAULT3DefaultQOS_CLASS_UTILITY2Utility thread running with reduced priority, e.g. menubar utility app.QOS_CLASS_BACKGROUND1Background thread with reduced priority, e.g. backup.QOS_CLASS_UNSPECIFIED0Unknown level.This is great to priorize theOf course, we also have the Process.GetQOSClass function, which retrieves the value for the current thread.XLAs with most releases, there are new features to report in the XL area as well.With the new XL.Book.Clear function, you can remove all data from an Excel workbook at once. With the XL.Book.ErrorCode function, you can retrieve the last error code to better understand and resolve errors. The XL.Book.SheetName function allows you to determine the sheet name for a specific sheet index.With XL.LoadBookInfo, you can load only the metadata for an Excel document. You can specify the document in the parameters as a container or as a path. Additionally, the parameters type (for the file type) and password are available here if needed. You can then use the reference number you receive with this function, for example, with XL.Book.SheetName or XL.Book.SheetCount.If [ MBS("XL.IsInitialized") ≠ 1 ] Perform Script [ “InitXL” ; Specified: From list ; Parameter: ] End If Set Variable [ $xl ; Value: MBS( "XL.LoadBookInfo"; "/Users/sj/Desktop/test1.xlsx" ) ] Set Variable [ $count ; Value: MBS("XL.Book.SheetCount"; $xl) ] Set Variable [ $i ; Value: 0 ] Set Variable [ $Name ; Value: "" ] Loop [ Flush: Always ] Exit Loop If [ $count-1 < $i ] Set Variable [ $Name ; Value: $Name & MBS("XL.Book.SheetName"; $xl; $i) & "¶" ] Set Variable [ $i ; Value: $i+1 ] # End Loop Show Custom Dialog [ "Excel Metadata" ; "Sheet Count: " & $count & "¶¶Sheet Names:¶" & $Name ] Set Variable [ $r ; Value: MBS( "XL.Book.ReleaseAll" ) ] In addition, we've also included new functions for conditional formatting. The XL.Book.ConditionalFormatSize function returns the number of conditional formats in the workbook. With XL.Book.ConditionalFormat, we can retrieve a conditional format by its defined index.To determine the number of conditional formatting rules in this worksheet, we use the XL.Sheet.ConditionalFormatSize function. To retrieve such a rule in an XLSX document, we use the XL.Sheet.ConditionalFormatting function with the appropriate index. In the same way, we can also remove this rule using XL.Sheet.RemoveConditionalFormatting.Graphics MagickWith the new GMImage.Profiles function, you can obtain a list of available profiles for an image. Such a list might look like this, for example:MacThere are also new features for Mac and the iOS SDKTranslationIn the last release, we introduced the new Translate section, which supports on-device translation on macOS and iOS 26 or later and can also be useful on older devices with a compatible model. In this release, we would like to add another feature to this component. With Translation.DetectLanguage, you can determine the language of a given text. The function returns the identifier for the corresponding language. To identify the language, you usually need more than one word to ensure that the language can be assigned without a doubt.Set Variable [ $r ; Value: MBS("Translation.Available") ] Set Variable [ $t ; Value: "Das ist ein Text" ] Set Variable [ $language ; Value: MBS("Translation.DetectLanguage"; $t) ] Show Custom Dialog [ "Language of a text" ; "Text: ¶" & $t & "¶¶Language: " & $language ] GoodiesIn this release, we've once again added free features designed to support you as a developer.First, we've made our search function for Mac and Windows-which we introduced in the last release-a bit more organized. Entries are now grouped, and these groups can be expanded or collapsed. When you click on an entry in the search results, it is highlighted in blue; entries from comments are displayed in gray; and your search results are numbered. We've also added a button in the menu that lets you copy the content of the search results.In the Syntax Coloring section, we have new features for our Mac users. Here, we've added two functions that let you decide whether to include a space before the semicolon when formatting your calculations. This can make large calculations easier to read. Use the SyntaxColoring.SetFormatAddSpaceBeforeSemicolon function and set the parameter to 1. Then you can click the formatting button and see that the appropriate semicolons have been added.With SyntaxColoring.GetFormatAddSpaceBeforeSemicolon, you can check whether the formatting of the extra semicolon is enabled.The ScriptWorkspace section also features a new function: ScriptWorkspace.SelectGroup. It selects a group of scripts. In the parameters, you can specify which group to select and, optionally, expand the item.WindowsLast but not Least we also have news for Windows user.DialogThere are new functions for Windows in the Dialog section. With Dialog.SetTitleIcon, you can display a custom icon in the title bar. You specify this image as a container value in the function’s parameters.With the Dialog.GetTitleIcon function, you can retrieve an already set title icon for a dialog.We hope you will also find some interesting new features. We wish you a lot of fun with MBS FileMaker Plugin Version 16.1. If you need a license or have any questions, please contact us.
Create an account or sign in to comment