MBS FileMaker Plugin, version 7.6pr4


New in this prerelease of the 7.6 MBS FileMaker Plugin:
  • Added MetaDataQuery functions for macOS and iOS, usually called Spotlight search.
  • Improved Syntax Highlighting speed for macOS 10.13.
  • Fixed problem where plugin would colorize script even when it's disabled in preferences.
  • Changed Audit to be able to use UUID field, even if it's not in the field list passed to audit function.
  • Fixed bug with PDFKit.Watermark for High Sierra.
  • Fixed bugs with DynaPDF.Print and scaling pages for some printers.
Download at monkeybreadsoftware.de/filemaker/files/Prerelease/ or ask for being added to the dropbox shared folder.

Spotlight search in FileMaker with MBS Plugin


We got a nice new search feature for our MBS FileMaker Plugin. You can create searches, run them and query results. Here is an example script to search all applications:

Set Variable [ $query ; Value: MBS( "MetaDataQuery.Create" ) ] 

Set Variable [ $r ; Value: MBS( "MetaDataQuery.SetQueryString"; $Query; "kMDItemContentType=\"com.apple.application-bundle\"") ] 

Set Variable [ $r ; Value: MBS( "MetaDataQuery.StartQuery"; $Query) ] 

# Wait for search to finish

Loop

Pause/Resume Script [ Duration (seconds): ,2 ] 

Exit Loop If [ MBS( "MetaDataQuery.IsGathering"; $Query ) = 0 ] 

End Loop

# Stop

Set Variable [ $r ; Value: MBS( "MetaDataQuery.StopQuery"; $Query) ] 

Delete All Records [ With dialog: Off ]

# Put global result on top:

Set Field [ Search Applications::All Results JSON ; MBS( "MetaDataQuery.Results"; $Query ) ] 

Set Variable [ $Count ; Value: MBS( "MetaDataQuery.ResultCount"; $Query ) ] 

Set Field [ Search Applications::ResultCount ; $Count ] 

# And show records:

Set Variable [ $index ; Value: 0 ] 

Loop

New Record/Request

Set Variable [ $path ; Value: MBS( "MetaDataQuery.PathAtIndex"; $Query; $Index ) ] 

Set Variable [ $result ; Value: MBS( "MetaDataQuery.ResultAtIndex"; $Query; $Index ) ] 

Set Field [ Search Applications::Name ; MBS( "Files.FileDisplayName"; $Path ) ] 

Set Field [ Search Applications::FilePath ; $path ] 

Set Field [ Search Applications::Attributes JSON ; $result ] 

Set Field [ Search Applications::Icon ; MBS( "Icon.GetIcon"; $Path; 128 ) ] 

Commit Records/Requests [ With dialog: Off ] 

# next

Set Variable [ $index ; Value: $index + 1 ] 

Exit Loop If [ $index ≥ $count ] 

# Lets exit when we have 100 items

Exit Loop If [ $index > 100 ] 

End Loop

Set Variable [ $r ; Value: MBS( "MetaDataQuery.Close"; $Query ) ] 

As you see, we create a new query. Than we set the query string where we check if content type is an application. We start the seach which runs asynchronously in the background. For this example we use a loop to wait for the search to finish getting results. Than we stop query and check results. For the results, we give you two ways: You can have all the attributes as JSON or you just get the file path of the item.

The example database here shows the applications in records. We put in the icon of the application, show the display name, the path. The JSON is also stored and can be inspected. Please try with next prerelease and let us know whether you like it.


Trigger FileMaker Scripts from JavaScript in FileMaker 16


As you may know FileMaker 16 on macOS uses WebKit 2.x, so our old WebView.InstallCallback function broke. We got a workaround using WebView.Create for creating WebKit 1.x web viewers in FileMaker 16 and using older WebKit functions.

Now we have a new way for WebKit 2.x using a JavaScript bridging. With macOS 10.10 (and iOS 8.0) Apple introduced the ability to install custom JavaScript message handlers for WKWebView. We just added them for our plugins to call back from JavaScript to FileMaker scripts.
First you call Webview.AddScriptMessageHandler function to register a name:

MBS( "Webview.AddScriptMessageHandler"; Name )

Next you can use it in Javascript to trigger a script in FileMaker from JavaScript:

window.webkit.messageHandlers.test.postMessage({'filename':'WebView Message Handler.fmp12', 'parameter':'Hello World from JavaScript', 'scriptName':'test'});

And you can evaluate an expression in JavaScript:

window.webkit.messageHandlers.test.postMessage({'evaluate':'MBS( "Msgbox"; "Hello from Evaluate in JavaScript" )'});

As you see, we get for our message handler a new entry in the namespace called window.webkit.messageHandlers.test. This allows us to call postMessage method there and this triggers the plugin code to trigger scripts or do evaluation. The parameter to the postMessage must be a Javascript object with a few properties:
  • fileName: The name of the file with the script.
  • scriptName: The name of the script to trigger.
  • parameter: The parameter to pass to the script.
  • evaluate: The expression to evaluation.
This works nice in first tests and we'd love to see what you can do with this technique. Please try with next prerelease or email us for a copy today.

PS: Works in FileMaker 16 runtimes, too.

Upload email to Sent folder via IMAP


As you know you can send emails via the CURL functions in MBS Plugins for Xojo and FileMaker. To have your mails how up in sent folder, you need to upload them to the IMAP server. The following script does it for FileMaker. Key thing is to pass in URL to IMAP Server with name of Mailbox, e.g. "imap://imap.monkeybreadsoftware.de/INBOX.Sent". Than you set the upload option and provide the data to send. Of course you should use SSL, certificate verification and pass in your credentials. So here the FileMaker script from the sample database:
 

Set Variable [ $curl ; Value: MBS("CURL.New") ] 

# Set URL with name of the mailbox included:

Set Variable [ $result ; Value: MBS("CURL.SetOptionURL"; $curl; CURL Test::URL & "/INBOX.Sent") ] 

# We upload

Set Variable [ $result ; Value: MBS("CURL.SetOptionUpload"; $curl; 1) ] 

Set Variable [ $email ; Value: CURL Test::email ] 

Set Variable [ $email ; Value: MBS("Text.ReplaceNewline"; $email; 3) ] 

Set Variable [ $result ; Value: MBS("CURL.SetInputText"; $curl; $email; "UTF-8") ] 

# your credenticals

Set Variable [ $result ; Value: MBS("CURL.SetOptionPassword"; $curl; CURL Test::Password) ] 

Set Variable [ $result ; Value: MBS("CURL.SetOptionUsername"; $curl; CURL Test::Name) ] 

# Maybe use alternative IMAP port?

// Set Variable [ $r ; Value: MBS("CURL.SetOptionPort"; $curl; 143) ] 

# This turns TLS on and requires connection to be encrypted

Set Variable [ $r ; Value: MBS("CURL.SetOptionUseSSL"; $curl; 3) ] 

# force TLS v1.2

Set Variable [ $r ; Value: MBS("CURL.SetOptionSSLVersion"; $curl; 6) ] 

# This disables certificate verification, so we accept any: 

Set Variable [ $r ; Value: MBS("CURL.SetOptionSSLVerifyHost"; $curl; 0) ] 

Set Variable [ $r ; Value: MBS("CURL.SetOptionSSLVerifyPeer"; $curl; 0) ] 

# Better with certificates if you have some:

// Set Variable [ $r ; Value: MBS( "CURL.SetOptionCAInfo"; $curl; "/Library/FileMaker Server/certificates.pem") ] 

// Set Variable [ $r ; Value: MBS("CURL.SetOptionSSLVerifyHost"; $curl; 2) ] 

// Set Variable [ $r ; Value: MBS("CURL.SetOptionSSLVerifyPeer"; $curl; 1) ] 

Set Variable [ $result ; Value: MBS("CURL.SetOptionVerbose"; $curl; 1) ] 

# do it!

Set Field [ CURL Test::Result ; MBS("CURL.Perform"; $curl) ] 

# Check result:

Set Field [ CURL Test::debug ; MBS("CURL.GetDebugAsText"; $curl) ] 

Set Variable [ $result ; Value: MBS("CURL.Cleanup"; $curl) ] 


Let me know whether this works fine for you. 
 
For Xojo this translate more or less 1:1 to the CURLSMBS class. The properties have the same name and you just pass email via SetInputData method. Just remember to make sure to use ReplaceLineEndings with EndOfLine.Windows.

MBS FileMaker Plugin, version 7.6pr3


New in this prerelease of the 7.6 MBS FileMaker Plugin: Download at monkeybreadsoftware.de/filemaker/files/Prerelease/ or ask for being added to the dropbox shared folder.

Install fonts for PDF generation in FileMaker Cloud


As you may have noted, FileMaker Could comes preinstalled with around 50 font faces. The font you love and use in layouts may not be included in the list. The fonts include in various styles:
  • Baekmuk Batang
  • Utopia
  • URW Gothic L
  • URW Bookman L
  • Century Schoolbook L
  • Dingbats
  • Nimbus Sans L
  • Nimbus Roman No9 L
  • Nimbus Mono L
  • URW Palladio L
  • Standard Symbols L
  • URW Chancery L
  • IPAPGothic
  • Liberation Mono
  • Liberation Sans
  • WenQuanYi Micro Hei Mono
  • WenQuanYi Micro Hei
  • WenQuanYi Zen Hei Mono
  • WenQuanYi Zen Hei Sharp
  • WenQuanYi Zen Hei
If you like, you can install more fonts with those easy steps:
  1. Get login for your FileMaker Cloud Server via SSH.
  2. Create a new folder in /usr/share/fonts folder for your fonts.
    e.g. sudo mkdir --mode=777 /usr/share/fonts/myfonts
  3. Copy fonts in your new folder.
  4. Run "fc-cache -f -v" command to update cache.
  5. You can verify with "fc-list" command whether fonts were found.
  6. Reboot machine or at least restart the WebDirect engine.
Now you can create PDFs with any font you like. Let me know if it works for you.

You can use MBS( "DynaPDF.AddFontSearchPath"; $PDF; "/usr/share/fonts"; 1 ) with our DynaPDF functions to use the fonts on the FileMaker Cloud.

MBS FileMaker Plugin, version 7.6pr2


New in this prerelease of the 7.6 MBS FileMaker Plugin: Download at monkeybreadsoftware.de/filemaker/files/Prerelease/ or ask for being added to the dropbox shared folder.

LDAP with JSON


For the next plugin prerelease, we introduce three JSON functions for use with our LDAP functions.

So you can use query and get the result as JSON with the new LDAP.JSON function. See this little example which connects and makes a query and finally shows the JSON in a dialog:

# Connect

Variable setzen [ $r ; Wert: MBS("LDAP.Connect"; "ldap.forumsys.com"; 0; 389) ] 

Wenn [ MBS("IsError") ] 

Eigenes Dialogfeld anzeigen [ "LDAP error" ; "Failed to connect." & ¶ & $r ] 

Sonst

Variable setzen [ $ldap ; Wert: $r ] 

# Login

Variable setzen [ $r ; Wert: MBS("LDAP.Bind"; $ldap; "uid=tesla,dc=example,dc=com"; "password"; "simple") ] 

Wenn [ MBS("IsError") ] 

Eigenes Dialogfeld anzeigen [ "LDAP error" ; "Failed to authenticate." & ¶ & $r ] 

Sonst

# Search

Variable setzen [ $r ; Wert: MBS("LDAP.Search"; $ldap; "dc=example,dc=com"; "subtree"; "(givenName=*)"; ""; 0; 20; 999) ] 

# Check results

Eigenes Dialogfeld anzeigen [ "JSON" ; MBS("LDAP.JSON"; $ldap) ] 

Ende (wenn)

# Cleanup

Variable setzen [ $r ; Wert: MBS("LDAP.Release"; $ldap) ] 

Ende (wenn)

 
The answer in JSON looks like this:
 

[{

"dn": "uid=test,dc=example,dc=com",

"attributes": [{

"name": "objectClass",

"values": ["posixAccount", "top", "inetOrgPerson"]

}, {

"name": "gidNumber",

"values": ["0"]

}, {

"name": "givenName",

"values": ["Test"]

}, {

"name": "sn",

"values": ["Test"]

}, {

"name": "displayName",

"values": ["Test"]

}, {

"name": "uid",

"values": ["test"]

}, {

"name": "initials",

"values": ["TS"]

}, {

"name": "homeDirectory",

"values": ["home"]

}, {

"name": "cn",

"values": ["Test"]

}, {

"name": "uidNumber",

"values": ["24601"]

}, {

"name": "o",

"values": ["Company"]

}]

}]
 
So we have an array of entries fill with an object for each entry. Each entry has attributes and there each value can have several values. 
 
For add, modify or delete, you can now use the LDAP.AddJSON and LDAP.ModifyJSON functions to pass in JSON formatted changes.
The structure looks like this:

[{
    "operation": "Add",
    "type": "xxx",
    "values": ["Hello", "World"]
},
{
    "operation": "Replace",
    "type": "yyy",
    "value": "Other"
},
{
    "operation": "Delete",
    "type": "zzz"
}]

Please try in next prelease.


FileMaker Cloud Tipps & Tricks


First, you may know we used to simply restart the FileMaker Cloud instance when we installed a new plugin. That is due to the fact that if old and new plugin have the same file name and the OS can’t distinguish them. When FileMaker tries to load a new one, it still gets the handle for the old plugin copy. I suggested to FileMaker Inc. to make a hard link to load it with a random postfix in file name.

But we found a workaround. You can simply rename the plugin each time before adding it to the container to upload. So if first plugin is MBS1.fmx and you install MBS2.fmx via Install Plugin Script Step, you get the new one loaded and the old file is deleted. That’s great way to solve this. For the next plugins, we simply include the build number in the linux file name, e.g. MBS.3100.fmx to help you install it easily.

Second, whenever a plugin crashes the FileMaker Server scripting process, you see error 812 on the client. That can be irritating, but it simply means the client didn’t get an answer due to the lost connection.

Third, you may want to see debug messages from the plugin. Especially if we want to debug an issue. As none of the log files so far contain our debug messages, we change the plugin for next prerelease to redirect them itself. Within the /FileMakerData/Logs folder we create two new files ServerScriptingPluginsStdOut.log and ServerScriptingPluginsStdErr.log to log messages from stdout and stderr. Trace messages and debug messages end up in stderr. Regular outputs of messages may be in the stdout file.

I now usually connect two Terminal windows via SSH and run the commands to output the files live:

tail -f ServerScriptingPluginsStdOut.log
tail -f ServerScriptingPluginsStdErr.log

So in both windows I can watch live what is going on. To exit tail, you can press Control-C.

Forth, the FileMaker Cloud linux is secure. This includes that you can’t simply list all environment variables. EnvironmentVariables.Names returns an empty list. But you can still query some variables:
MBS( "EnvironmentVariables.Value"; "LANG" ) returns "en_US.UTF-8"

The MBS Plugin performs well on the FileMaker Cloud, although that's currently only 5% of the servers out there as far as we know about. Popular functions used on the FileMaker Cloud include our CURL functions, SQL functions within FileMaker and JSON functions.

Three weeks till year's end


The year 2017 will end in less than three weeks. Do you need some more licenses?
  • You can order licenses for 2018 or later and have invoice, delivery and payment done in 2017.
    This way you secure the current pricing and the possibility to keep upgradeability for older licenses.
  • And of course you can order updates for several years in advance for all your MBS products.
  • DynaPDF licenses are on sale for December 2017 with 25% automatically.
  • As all our Xojo and DynaPDF plugin licenses are per developer, you should check if you got a new developer in your team this year and adjust licenses to match team size.
  • If you need a Xojo license (new or update), we can always check whether a bundle with Xojo offers an advantage for you. Or we can point you to the next sale or a coupon code for the Xojo Store.
  • For FileMaker please check if you have enough license for the number of seats or servers you have in use.
    If you upgrade to unlimited seats or servers, the plugin won't need to check the usage.
Especially if you run on a budget and you want to spend some money in the old year, you can buy updates for several years in advance.
If you need help to decide what Xojo, FileMaker or plugin license you need, we may be able to assist you.

FileMaker Magazin - MBS Artikel


For our German speaking users:

Wir haben die Artikel zum MBS Plugin aus dem FileMaker Magazin gesammelt hier online gestellt:
FileMaker Magazin Artikel:

Wir empfehlen allen FileMaker Anwender ein Abo vom Magazin und den Kauf der alten Ausgaben. Das FileMaker Magazin ist eine excellente Quelle von Informationen, Anleitungen und Profitips.


MBS FileMaker Plugin, version 7.6pr1


New in this prerelease of the 7.6 MBS FileMaker Plugin: Download at monkeybreadsoftware.de/filemaker/files/Prerelease/ or ask for being added to the dropbox shared folder.

List of DynaPDF error codes


For your convenience, here a list of all error codes with messages for lookup.

DynaPDF Error List

Don't forget the DynaPDF Christmas Sale. A great chance to upgrade and add maintenance at lower prices.

FileMaker Cloud, best with BYOL


Be aware of a little limitation when using FileMaker Cloud with annual subscriptions for the FileMaker Server software with AWS:

If you purchased an annual licnese via the Amazon Marketplace, do not change the instance size after installation. Doing so will switch your instance to become hourly billed.


So if you ever plan to up/downscale without hassle on the FileMaker Cloud servers, you better go and buy the license from FileMaker directly (or a your favorite reseller).

With that license, you can easily switch from t2.medium on development (2 cores, 4 GB RAM) to t2.large (2 cores, 8 RAM) for a beta test and up to t2.2xlarge (8 cores and 32 GB RAM) for deployment on busy days. It would be pity if your next AWS bill for FIleMaker Cloud would be $700 for hourly billing, because you just changed instance type.

And you can use one license over the year for several servers independently. e.g. buy a FileMaker Server for a project in February, terminate the server in April and later in August start a new one for another project with the existing license.

For details, please check answer 25984.

Following the license rules


We are software developers and make a living from selling our software. Ourselves we pay for licenses to enable others to make a living. This includes paying royalties for libraries used in our plugins which enable the continued development of those libraries. And we expect our clients to pay their license fees and indeed the majority does it correctly and pays their bills.

Technically we don’t enforce it directly. Xojo itself has a server based activation, FileMaker Pro doesn’t, but the Server talks back to FileMaker Inc.. Personally we don’t like to use an activation for the plugins, so we only check license keys locally. We also do some statistics on the usage of the plugins, so we know what versions are in use on which operation systems. And we can see which license keys are in use.

The licensing terms for Xojo and FileMaker are quite clear. You can have a trial for FileMaker Pro and for Xojo simply use the software without a license. Those are limited in a couple of ways. But when you get productive, you should really get a license key. You need one license per developer and you do not share license between developrs. For Xojo you need to have a Pro key to use version control software, so you buy the Pro licenses when you want take part in a bigger development project. For FileMaker you should have a license for Pro Advanced when you develop and of course you pay it.

For using plugins we expect that you match the licenses for plugins with those for Xojo and FileMaker. So if you have two Xojo licenses for two developers and both developers work on the projects using the plugins, we expect you to buy two licenses. We want bigger companies to contribute more for the tools than a small one person company. For FileMaker you pay for each server a license to FileMaker Inc. and we expect that you also pay for each server using MBS Plugin the license fee to us. That may result in paying for every developer including trainees and managers. We do know that some things may be temporary and for that reason like to issue trial keys to use our plugins without paying for a limited time.

Luckily the statistics show that nearly everybody obeys the licensing terms and that makes me happy. We do have Xojo plugins in use for development on at least a thousand computers. We don’t know about deployment as we don’t want to track that! Still MBS Xojo Plugins is used in thousands of applications with properly hundred thousands installations. I know some Xojo applications using my plugins which sold over 10000 times. Our FileMaker plugin is used on tens of thousands computers and that makes us happy. We got some success there over the years.

On the other side the statistics reveal some really bad guys. We learnt that there are license keys used, which we never created. Someone clearly hacked the plugins. And some users really use the plugin on much more computers than intended. Like the company who runs 26 servers with just one server license for our FileMaker plugin. Or a company with eight Xojo developers and just one license key. Same with a FileMaker solution with a 5 seats key, which was in use on 21 computers on a single day last month. And those calculations include a filter which removes the occasional use of a key for a day or two on another computer.

Today I double checked this and contacted a few clients which exceed the license terms a lot. Not the job I like to do.

Booked for Montreal


For the upcoming Québec FileMaker Developers Conference (QFDC) next year in Montreal, I am happy to be signed up a sponsor and I booked my flight already. Due to flights being much cheaper going to Toronto, I will come to visit that nice town and maybe organize a local developer meeting there.

Montreal at night

The conference will probably be announced soon, but it may be good to keep mid March free for now.

Birthday of our video page


Ten years ago we started created tutorial videos and today our video page has birthday. Enjoy a video and learn about our plugins.

Over the years we collected more than 80 videos. We hope you enjoy them!

Watch Xojo Videos - FileMaker Videos

Youtube channels:

We know we could make more videos. So what wishes do you have?
Please email us or post a comment here.

DynaPDF Christmas Sale


We just got notice from DynaForms about their Christmas Sale for this year:

Christmas Special: 25% Off on anything!

As a thank you for the good collaboration and your trust, you get 25% Christmas Discount on anything til the end of the year!

I wish you and your family Merry Christmas and a successful new year.

With kind regards

DynaForms GmbH

The MBS online shop is updated and we reduced all our DynaPDF prices by 25%. So if you need a new license or updates for up to five years, please order. If you have questions, please do not hesitate to contact us.
Order for Xojo - Order for FileMaker

Archives

Dec 2017
Sep 2017
Aug 2017
Jul 2017
Jun 2017
May 2017
Apr 2017
Mar 2017
Feb 2017
Jan 2017
Dec 2016
Nov 2016
Oct 2016
Sep 2016
Aug 2016
Jul 2016
Jun 2016
May 2016
Apr 2016
Mar 2016
Feb 2016
Jan 2016
Dec 2015
Nov 2015
Oct 2015
Sep 2015
Aug 2015
Jul 2015
Jun 2015
May 2015
Apr 2015
Mar 2015
Feb 2015
Jan 2015
Dec 2014
Nov 2014
Oct 2014
Sep 2014
Aug 2014
Jul 2014
Jun 2014
May 2014
Apr 2014
Mar 2014
Feb 2014
Jan 2014
Dec 2013
Nov 2013
Oct 2013
Sep 2013
Aug 2013
Jul 2013
Jun 2013
May 2013
Apr 2013
Mar 2013
Feb 2013
Jan 2013
Dec 2012
Nov 2012
Oct 2012
Sep 2012
Aug 2012
Jul 2012
Jun 2012
May 2012
Apr 2012
Mar 2012
Feb 2012
Jan 2012
Dec 2011
Nov 2011
Oct 2011
Sep 2011
Aug 2011
Jul 2011
Jun 2011
May 2011
Apr 2011
Mar 2011
Feb 2011
Jan 2011
Dec 2010
Nov 2010
Oct 2010
Sep 2010
Aug 2010
Jul 2010
Jun 2010
May 2010
Apr 2010
Mar 2010
Feb 2010
Jan 2010
Dec 2009
Nov 2009
Oct 2009
Sep 2009
Aug 2009
Jul 2009
Apr 2009
Mar 2009
Feb 2009
Dec 2008
Nov 2008
Oct 2008
Aug 2008
May 2008
Apr 2008
Mar 2008
Feb 2008