MBS FileMaker Plugin, version 10.1pr4


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

Improve your work live balance with do not disturb


To improve the balance between work and live, some simple things can help:

First, it's a great idea to set a rule in the household to have no phones for meals. So I just leave my iPhone in the office, so it doesn't grab my attention. Some families have baskets for the phones so when you enter kitchen, you put it there. We'll see if we do this when our children get older and we get more devices.

Next figure out the time you allow others to disturb you. The default setting for iOS is to be silent between 22:00 at night and 7:00 o'clock in the morning. Now it seems to work better for me to move those times to 20:00 and 9:00 o'clock. In the morning I may get up long before 9, but to get ready, have breakfast and read through emails, it may be 9 when I am ready to take calls.

For the evening it's difficult alone to get away from work and not work till midnight, but at least the iPhone won't disturb me when I am busy doing some focused work, or watch a movie with my family.

What do you do to get some rest from screens?

Automate login to FileMaker Admin Console in web viewer


Today a client asked how to automate login to the admin console when it is open in a web viewer within a FileMaker solution. You probably saw the video Automate web viewer already?

The login here is a bit more difficult as you need a couple of JavaScript calls to login, but here is a script that works for us:

Set Variable [ $JS ; Value: "
function SendEvent(o, name)
{
  // send event to JavaScript event listeners¶
  var evt = document.createEvent('Events');
  evt.initEvent(name, true, true);
  o.dispatchEvent(evt);
}

// set user name¶
o = document.getElementById('inputUserName');
o.focus();
o.value = '" & Admin Console::Username & "';
SendEvent(o, 'input');
SendEvent(o, 'blur');

// set password¶
o = document.getElementById('inputPassword');
o.focus();
o.value = '" & Admin Console::Password & "';
SendEvent(o, 'input');
SendEvent(o, 'blur');

document.getElementById('LOGN_Butn_SignIn').click();" ]
Set Variable [ $r ; Value: MBS("WebView.RunJavaScript"; "web"; Substitute ( $JS; ¶; Char(10) )) ]

As you see we define an utility function in JavaScript to trigger an event programmatically. This is required as the login form has event listeners in JavaScript which validate the fields and we need those to enable the Sign In button for us. we do the following steps for each field. We query the field by its ID, set the focus, enter the text and trigger input event to have the JavaScript recognize the changes and then blur it to remove focus. Finally on the end we trigger a click on the login button.

Please note that for text in a formula FileMaker removes the line breaks, so for each comment we add a ¶ character to indicate we want a line break there. Also we do a replace all here to change line endings to unix line endings before we run it with the WebView.RunJavaScript function.

If you have questions, please don't hesitate to contact us. The example will be included with next plugin version.

Core Location Geocoder with JSON


When we implemented CLGeocoder functions in year 2014, there was not much JSON in use. Nowadays a lot of FileMaker developers deal with JSON data, so why not add more JSON functions to MBS Plugin?

We got a refreshment for our CLGeocoder functions today. For next plugin we first add a wait parameter to CLGeocoder.GeocodeAddressString and CLGeocoder.ReverseGeocodeLocation functions. If wait is 1, the plugin waits a bit until the geocoder is done. Just convenient to avoid having the loop to wait in FileMaker scripts.

Second, we add a CLGeocoder.JSON function to return the data as JSON. This is one big JSON which encodes all the details including status variables, error details and the list of place marks found. For each place mark you get the location, region and address properties.

We can now query address in one Let statement, check status and return the result as JSON:

Let ( [
  Address = "Berlin, Germany";
  // run query and wait a bit
  g = MBS( "CLGeocoder.GeocodeAddressString"; Address; 1 );
  e = MBS("IsError");
  // query JSON if we got something
  r = If (e = 0; MBS( "CLGeocoder.JSON"; g ); g);
  // free resources
  f = If (e = 0; MBS( "CLGeocoder.Close"; g ); 0)
]; r )

Similar let statement for the other way around:

Let ( [
  latitude = 52.517631899999998;
  longitude = 13.4096574;
  // run query and wait a bit
  g = MBS( "CLGeocoder.ReverseGeocodeLocation"; latitude; longitude; 1 );
  e = MBS("IsError");
  // query JSON if we got something
  r = If (e = 0; MBS( "CLGeocoder.JSON"; g ); g);
  // free resources
  f = If (e = 0; MBS( "CLGeocoder.Close"; g ); 0)
]; r )

We add this for next release for your convenience. Please do not hesitate to contact us in case of questions.

MBS FileMaker Plugin, version 10.1pr3


New in this prerelease of version 10.1 of the MBS FileMaker Plugin:
  • Added parameters for CNContactPicker.Show to set position.
  • Removed check from ImageCapture.RequestScan to check for open session.
  • Changed DynaPDF.Initialize to accept Starter, Lite, Pro and Enterprise texts for demo modes again.
  • Changed Socket.NewTCPSocket to mark sockets to accept IPv4 connections on IPv6 sockets.
  • Added checkbox for preferences to turn font changes on/off.
  • For DynaPDF we will rename the DLL to have 64-bit library named dynapdf.dll in future and dynapdf32.dll for the 32-bit version.
  • Updated DynaPDF to version 4.0.37.104.
  • Fixed issue with FM.RunDatabaseDesignReport to work in MacOS Catalina. Needs accessibility permissions in system preferences to click save button.
Download at monkeybreadsoftware.de/filemaker/files/Prerelease/ or ask for being added to the dropbox shared folder.

FileMaker vs. CURL versions


Here is a list of which FileMaker version includes which CURL version:
FileMaker versionCURL Version
11.0.47.19.4
12.0.57.21.6
13.0.97.21.6
14.0.47.38.0
15.0.37.44.0
16.0.47.51.0
17.0.37.58.0
18.0.37.62.0
You can learn about CURL releases on the curl website.

Why do we care? Well, if you still use FileMaker before version 16, your FileMaker scripts using Insert From URL are affected by the TLS certificate bugs in older CURL versions. And if certificate verification is not done right, someone can attack your queries, gain your password or provide invalid data to your solution. So please keep FileMaker up to date!

As with MBS Plugin, Claris Inc. also regularly updates the open source libraries used. Usually you do that on the begin of the development cycle, so you have time to find and issues from the newer library version like a bug fix, which changes behavior in a way you didn't intent. e.g. we run into CURL change for email download via IMAP.

MBS Plugin 10.1 will include CURL version 7.68.0 and MBS Plugin 10.0 shipped with version 7.67.0.

Our JavaScript engine, a game changer


Yesterday Sean Beach, one of our clients in New York emailed me back about our JavaScript integration. To quote him:

"Wanted to follow back and say that this plugin is a game changer for my showcontrol product. Thanks so much!”

The discussion was about our JavaScript functions and a couple of his questions got answered in our Tips for our JavaScript functions blog post:

"This document is fantastic, and actually answers most of my questions from the previous email."

We are delighted about the feedback we got!

The same day Stefanie got two of her latest articles published about using JavaScript to calculate distances.

On our FileMaker blog the version using our FileMaker Plugin:
FileMaker and JavaScript - the perfect combination

And even on the official Xojo blog an article about our Xojo class to run JavaScript:
Xojo and JavaScript – A Perfect Combination

We are happy to see that our JavaScript integration is so well received by clients from around the world. And it just started with a hint from one user in early December to take a look into this topic.

Check out the JavaScriptEngineMBS class for Xojo and the JavaScript functions for FileMaker!

20 Years Monkeybread Software Party


This year in April our company will turn 20 years old.
We'll plan to have a big party here in Germany near our office with over 100 guests.

Today we send invitations to guests who have not yet responded.

If you like to join and you miss an invitation, you can contact us and ask whether your invitation got lost.

As people confirm they are coming, we'll add them to the guest list. If we run out of space, we may put people on the wait list.
If you can't make it, please respond soon, so we don't need to contact you again later.

MBS FileMaker Plugin, version 10.1pr2


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

FileMaker and JavaScript - the perfect combination


In the newest version of the MBS FileMaker Plugin 10.0 we offer functions for the use of JavaScript without the use of a web viewer. See WebView.RunJavaScript and WebView.Evaluate to run or evaluate JavaScript in a web viewer. The new JavaScript functions increase your functionality in FileMaker enormously. You can write your own Javascript, use a JavaScript snipped that fix a problem or fast up a process of your solution. In this article I want to show you how to use JavaScript code in FileMaker: Setting values in the JavaScript with functions in FileMaker, add functions and run them.

If you have a problem that you want to solve, you don't have to reinvent the wheel again and again. Perhaps someone has already found a solution to this problem and shared his solution on the Internet. So start a search engine and try your luck. Special thanks to André Rinas and his website andrerinas.de that supply very useful JavaScript snippets to everyone. This example is based on one of this JavaScript codes.

(more)

FileMaker Stammtisch Rhein-Main


Der nächste FileMaker Stammtisch in Rhein-Main findet diese Woche am Donnerstag, den 6. Februar 2020 in Hofheim-Wallau statt.

ca. 19 bis 23 Uhr im Ristorante BELLA BARI - Hessenstraße 1 - 65719 Wallau.

Themen diesmal FileMaker Konferenzen in 2020 und gerne auch Fragen an mich zum MBS FileMaker Plugin 10.0.

Gerne könnt ihr eure FileMaker Lösungen mitbringen und bei Probleme und Fragen direkt vorführen. Eventuell hat jemand in der Runde ja eine Lösung für euch.

siehe Denkform Webseite

Zur MBS Plugin Schulung am 7. Mai 2020 sind noch Plätze frei und die Frühbucherrabatt für die FileMaker Konferenz endet am 20. Februar 2020.

Tips for our JavaScript functions


Here a few tips we recently learnt for our JavaScript engine based on Duktape in the MBS Plugins for FileMaker and Xojo:
  1. Use performance.now() to get time within JavaScript and measure how long something takes. Here an example where we measure how many milli seconds it takes to run a loop one million times:
    function testFunction() {
        for (var i = 0; i < 1e6; i++) {}
    }
    
    var t1 = performance.now();
    testFunction();
    var t2 = performance.now();
    
    Print('test took: ' + (t2 - t1) + ' milliseconds');
  2. All global functions and properties in JavaScript are attached to the global object. You can access them explicitly via globalThis keyword.
  3. List global properties via JavaScript:
    Var list = Object.keys(globalThis);
    The list will include all global names including functions like Print registered by MBS Plugin.
  4. Check Duktape.version for the version number. If we update the engine, you can check the version number and compare. Currently the value is 20500 for version 2.5.
  5. Use unicode escapes in strings if needed to mask special characters. While the engine handles UTF-8 fine, you can escape some characters with \u followed with a hex 4 digit number, e.g.
  6. n = '\u0041';
    Which will assign "A" to variable n.
  7. Use built-in functions to encode text as hex or base64 via Duktape.enc:
    Duktape.enc('base64', 'Hello')
    This returns "SGVsbG8=".
  8. Use Duktape.dec and TextDecoder class to decode base64/hex encoded text to UTF-8 string:
    var result = new TextDecoder().decode(Duktape.dec('base64', 'Zm9v'));
    Result is now a variable with text "foo".
  9. Access call stack with Duktape.act function. Query Duktape.act(i) with various values of i. Pass -1 for the act() call, -2 for the current function and -3 for the caller of current function. The returned object contains properties for lineNumber and function. When you query function.name, you get the name of the function.
  10. Add console object if needed. You can add a console object and include a log function, which sends arguments to a Print function:
    console = { log: function() { Print(Array.prototype.join.call(arguments, ' ')); } };
  11. Provide environment some JavaScript may need. If some JavaScript expects a global window object to store something, you can simply create a dummy one:
    window = {};
    This may not provide functionality, but allows at least code to check for this to work.
  12. Prefer functions over evaluating code. Code in functions is parsed and uses registers for the virtual machine, while code evaluated may use named variables, so if you can put your code in a function and just evaluate the function call, things may execute a bit faster.
  13. Be aware all numbers in JavaScript are doubles. Evaluate "9999999999999999" and you get "10000000000000000" back. Comparing numbers may not give the result you expect as "0.1+0.2==0.3" evaluates to false.
If you have questions, please do not hesitate to contact us. See also JS.Evaluate and related JavaScript functions in MBS FileMaker Plugin and JavaScriptEngineMBS class in MBS Xojo Plugins.

Font setting for FileMaker Script Workspace


Who tried the MBS Plugin 10.1pr1 and changed the font size via preferences dialog?



Let us know your experience. Does it help? What is your favorite font and size?

See A font preference for FileMaker and Using a different font in FileMaker

Archives

Feb 2020
Jan 2020
Dec 2019
Nov 2019
Oct 2019
Sep 2019
Aug 2019
Jul 2019
Jun 2019
May 2019
Apr 2019
Mar 2019
Feb 2019
Jan 2019
Dec 2018
Nov 2018
Oct 2018
Sep 2018
Aug 2018
Jul 2018
Jun 2018
May 2018
Apr 2018
Mar 2018
Feb 2018
Jan 2018
Dec 2017
Nov 2017
Oct 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