MBS Syntax Colorizing saves the day!

We received an email today from Russell Watson and we like to share it with you:

For some reason in our solution some global variables were not being defined …

Where we always define 3 debugging variables ...



… for some reason only one was being defined:



What’s up?

Having first checked everywhere, that three global variables were being defined, we finally got on the track of the bug thanks to the MBS plugin syntax coloring, which was showing an ‘anomaly’ in one of the Let definitions:



Why is the first $ black?

Inspecting the DDR with a text editor which displays control characters (Textmate 2) gave us the final clue:



In the middle of the calculation, just in front of the $$ variable name there are UTF-16 BOM-characters to be found!

(A BOM is a Byte-Order-Mark which usually is only to be found at the very start of a UTF-16 text file, as can be seen when you look at a UTF-16 text file with a hex-editor, for example a DDR file:



The FF identifies the low byte and the FE identifies the high byte … thus the U+FEFF in the editor is the unicode BOM code point)

Editing the calculation to remove and re-enter the whitespace and the first $ symbol cleared the problem:



MBS Plugin happy = We’re happy !

Thank you MBS!
Thank you Christian Schmitz!

If you have stories to share, please let us know.

Crop a two side page document to a single page document

Have you ever had the problem that you scan documents that’s are printed with two pages on each side and you need this document as a single page Document?

The MBS Xojo Plugins can help you with this problem in Xojo. Our Xojo Plugins includes a GraphicsMagick plugin. With the classes in this plugin you can do a lot of graphic editing, like using graphics effects, add text on an image or crop an image by a given area. Compared to Xojo pictures, we can work even with 16bit color depth here and use exact same functions cross platform.

In this article I want to show you how to cut the pages and set a serial page number at the bottom of each page. At first we load the scanned pictures from a folder to our application. For that we query the folder items to an array. With the method SortedFilesMBS we get an array that is sorted by name already. In the parameters of this method, we can set as the second Parameter that we want to sort the array by filenames. My scanned documents are names Scan_1, Scan_2 and so on.

Dim folder As FolderItem = SpecialFolder.Desktop.Child("Scan")
Dim files() As FolderItem = folder.SortedFilesMBS(False, True, False)

Then we want to loop over this array and cut the pages:

Dim u As Integer = files.Ubound
For i As Integer = 0 To u

We load the current file in two GMImage Objects. One for the Left side (imageL) and one to the right side (imageR). Instead of loading the file twice, we use the copy constructor to get two identical image objects.

Dim imageL As New GMImageMBS(files(i))
Dim imageR As New GMImageMBS(imageL) // copy constructor

If no exception is raised, we determine the height and width of the target pictures. We imagine we have a Din A4 paper on which two pages are printed. The long site is at the bottom side. The page is halved on this side. Therefore we need the full height of the sheet but only half the width. The clipping area is defined as GMGeometryMBS object. In the parameters we can defined the height and width of the cropping rectangle and optional the position of the top left edge coordinates. The default position coordinates are 0/0. That’s why we don’t need to set the coordinates for the left mask. For the left side we only need the height and width of the output. The right side has the same size but the x position is different. It is the half of the long bottom page side and that is w.

Dim h As Integer = imageL.height
Dim w As Integer = imageL.width / 2
Dim geoL As New GMGeometryMBS(w, h)
Dim geoR As New GMGeometryMBS(w, h, w, 0)

With the method crop we cut out the pages.

imageL.crop(geoL)
imageR.crop(geoR)

Then we want to write a page number in the bottom of each page. For drawing on a GMImage we set a graphic object as a property of the image.Then we set the color, the stroke width and the font, before we setting the text and the position of the page number. Afterwards we can draw the page number to the image. We need to take care about the stroke width, because if the value is too big the number is no longer legible. We need to calculate the text of the page number. With each loop run we manage two pages, we multiply it with two. Our variable i starts at 0, but our first left side has the number 1. That's why we add 1 for the left side and add 2 for the right side. For this reason we have for the left side the formula: I * 2 + 1 and for the right side the formula I * 2 + 2.

The code for the right page number looks similar.

Dim drawL As GMGraphicsMBS = imageL.Graphics
drawL.strokeColor(New GMColorRGBMBS("black"))
drawL.strokeWidth(1)
drawL.Font("/Library/Fonts/Verdana.ttf")
drawL.Text(w / 2, h - 100, str(i * 2 + 1))
drawL.Draw

Next we set the format of the image, create folder items and save the images on our desktop in a folder named “Output”, creating it if necessary.

imageL.magick = "PNG"
imageR.magick = "PNG"
Dim Output as folderitem = SpecialFolder.Desktop.Child("Output")
Output.CreateAsFolder
Dim sl As FolderItem = Output.Child(Str(i) + "a.png")
Dim sr As FolderItem = Output.Child(Str(i) + "b.png")

imageL.write(sl)
imageR.write(sr)
Next

I hope that you like this example. We wish you lots of fun with the GraphicsMagick classes and functionalities. If you have any questions, please do not hesitate to contact us.

The new JSON.EqualContent function

Since version 10.0, released in January 2020, the MBS Plugin includes a new JSON function: JSON.EqualContent. This function checks whether two JSON texts have equal content. This function should not be mixed up with the JSON.Equals function, which checks if type and value are the same.

We want to compare the two functions directly. We have the values “123” as String and 123 as number. The values have the same content but different datatypes. If we write in the Script MBS( "JSON.Equals"; "\"123\""; "123") the result is 0 and that means that the parameter are not equal as data types don't match. If we pass both values to the JSON.EqualContent function the result would be 1, so the values are equal

MBS( "JSON.EqualContent"; "\"123\""; "123") => 1
MBS( "JSON.Equals"; "\"123\""; "123") => 0

We wish you much fun with this function. Let us know if you have questions about our MBS Plugin and the JSON functions.

By Stefanie Juchmes

Xojo developer meeting in New York City

The Xojo.Connect conference will take place March 25-27 in Nashville, TN. On our way to Nashville we stop in New York for a few days and we like to organize another Xojo developer meeting, this time in New York City.

Date set: 20th March 2020.
Please email us if you like to be added to the guest list.

We meet in a nice restaurant somewhere in New York City, so we can shop talk about Xojo and have dinner together. Time will probably be around 18 to 22 o'clock and you can of course come later or leave earlier.

If you are interested in private time for consulting, training or discussion MBS or Xojo topics, we can of course schedule a meeting. Please contact me directly interested.

Upcoming deprecations for MBS FileMaker Plugin

There are some deprecations and removals coming for the FileMaker platform and we may follow with the MBS Plugin. Currently we would like to learn who uses deprecated technologies and continues to need updated plugins from us in the future:

FileMaker Pro runtimes
Deprecated in version FileMaker 14, currently available in version 18 and probably gone for version 19.

Windows 32-bit
The number of people using 32-bit versions of Windows is falling quickly. Newer computers bought are 64-bit and come with a 64-bit Windows version. The roadmap for FileMaker shows 32-bit support on Windows as deprecated. FileMaker 19 may drop 32-bit support for Windows as it is not listed as supported feature for the New Claris support policy.

MacOS 32-bit
Since FileMaker version 14, FileMaker supports 64-bit on MacOS, so there hasn't been a request for a 32-bit plugin in some time.

FileMaker Cloud for AWS
The newer FileMaker Cloud 2.x does not have plugin support and the older 1.x Cloud is scheduled to have end of live at the end of calendar year 2021 (or a day later with 1st Jan 2022).

FileMaker 16 and 17
Those FileMaker versions have support end set to September 2020. See New Claris support policy

Windows versions 7.0 and 8.0
The New Claris support policy shows Windows 8.1 as lowest version for Windows.

If you are still interested in newer plugin versions and licenses for those items, please contact us or use this survey. We will manage a list here for the people needing features. In future we may produce a few more versions including support for the items listed above for some time, then drop a few and eventually concentrate on the newer versions only.

Multithreaded JavaScript usage

We got some interest from customers about our JavaScriptEngineMBS class and requests for better Memoryblock handling and threading. So for next prerelease of our 20.1 plugins, we include better handling of Memoryblocks. You can pass a memory block to JavaScript and receive a Memoryblock back. Either with using global properties or as parameter/result of a function or evaluate call. The data in the Memoryblock is copied and available in JavaScript as an UInt8 buffer of the matching size. We add GlobalMemoryBlock() to help you and pass a memory block which is then used by reference, so data is not copied and JavaScript can directly edit the memory from Xojo.



Combine this with our new EvaluateMT and CallFunctionMT methods and you can run various JavaScript codes on preemptive threads in the background and get all CPU cores busy. Our screenshot above shows 8 threads running the function to do the image effect 100 times.

Please makes sure the memory blocks are not released too early and you use one JavaScriptEngineMBS object per thread to keep things separated. If you access a JavaScriptEngineMBS object on two threads, we now raise an exception telling you the object is busy. Even if you use only one thread with one instance, you can keep your GUI responsive while JavaScript runs in background. Using Print and Input events or Xojo delegate method calls, it may talk to your main thread and the GUI. (more)

Merge PDF with table of contents

We got a new example database to show how to merge PDFs. One of the feature beside adding page numbers is to build a table of contents for the document with clickable entries:

Set Variable [ $pdf ; Value: MBS("DynaPDF.New") ] 

#

# create dummy page for table

Set Variable [ $r ; Value: MBS("DynaPDF.AppendPage"; $pdf) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.EndPage"; $pdf) ] 

# create table for index

Set Variable [ $r ; Value: MBS("DynaPDF.SetPageCoords"; $pdf; "TopDown") ] 

Set Variable [ $table ; Value: MBS("DynaPDF.Table.Create"; $pdf; 10; 2; 500; 20) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetFont"; $table; -1; -1; "Helvetica"; 0; 1; "unicode") ] 

Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetFontSize"; $table; -1; -1; 14) ] 

Set Variable [ $r ; Value: MBS( "DynaPDF.Table.SetColWidth"; $Table; 0; 450; 1 ) ] 

Set Variable [ $r ; Value: MBS( "DynaPDF.Table.SetColWidth"; $Table; 1; 50;1 ) ] 

# Build Table Of Contents

Go to Record/Request/Page [ First ]

Set Variable [ $destPage ; Value: 2 ] 

Loop

# open PDF

If [ not IsEmpty ( Merge PDFs::InputPDF ) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.OpenPDFFromContainer"; $pdf; Merge PDFs::InputPDF) ] 

If [ MBS("IsError") ] 

Show Custom Dialog [ "Failed to open PDF." ; $r ] 

Exit Script [ Text Result:    ] 

End If

Else If [ not IsEmpty ( Merge PDFs::InputPath ) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.OpenPDFFromFile"; $pdf; Merge PDFs::InputPath) ] 

If [ MBS("IsError") ] 

Show Custom Dialog [ "Failed to open PDF." ; $r ] 

Exit Script [ Text Result:    ] 

End If

Else

# no PDF?

End If

# check if we have pages to import

Set Variable [ $pageCount ; Value: MBS( "DynaPDF.GetImportPageCount"; $PDF ) ] 

If [ $pageCount > 0 ] 

Set Variable [ $lastPage ; Value: MBS("DynaPDF.ImportPDFFile"; $pdf; $destpage) ] 

If [ GetAsNumber($lastPage) >0 ] 

# put in a named destination for this new page

Set Variable [ $NamedDest ; Value: "Record" & Get(RecordID) ] 

Set Variable [ $NamedDestHandle ; Value: MBS( "DynaPDF.CreateNamedDest"; $PDF; $NamedDest; $DestPage; "Fit") ] 

# add table entry

Set Variable [ $rowNum ; Value: MBS("DynaPDF.Table.AddRow"; $table) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 0; "left"; "top"; Merge PDFs::InputName) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.Table.SetCellText"; $table; $rowNum; 1; "right"; "top"; $destPage) ] 

# add click action

Set Variable [ $Action ; Value: MBS( "DynaPDF.CreateGoToActionEx"; $PDF; $NamedDestHandle) ] 

Set Variable [ $r ; Value: MBS( "DynaPDF.Table.SetCellAction"; $Table; $rowNum; 0; $action; "Invert" ) ] 

Set Variable [ $r ; Value: MBS( "DynaPDF.Table.SetCellAction"; $Table; $rowNum; 1; $action; "Invert" ) ] 

Set Variable [ $destPage ; Value: $lastPage + 1 ] 

End If

End If

# optionally close import files

Set Variable [ $r ; Value: MBS("DynaPDF.CloseImportFile"; $pdf) ] 

# next file

Go to Record/Request/Page [ Next ; Exit after last: On ]

End Loop

# Draw Table

Set Variable [ $r ; Value: MBS("DynaPDF.EditPage"; $pdf; 1) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.Table.Draw"; $table; 50; 50; 742) ] 

Set Variable [ $r ; Value: MBS("DynaPDF.EndPage"; $pdf) ] 

# show final PDF

Set Field [ Merge PDFs::FinalPDF ; MBS("DynaPDF.Save"; $pdf; "Merged.pdf") ] 

Set Variable [ $r ; Value: MBS("DynaPDF.Release"; $pdf) ] 

The example file will be included in the next plugin prerelease. Please do not hesitate to contact us with questions.


One month till Xojo.Connect 2020 in Nashville

Just one month till the XOJO.CONNECT 2020 in Nashville, Tennessee, USA. Tickets are still available for $999 USD.



It will be held March 25-27, 2020 in Nashville, TN at the Sheraton Music City Hotel. This conferences is the best place to meet Xojo developers from around the world in real live, make contacts, present yourself as expert and learn what is new in Xojo. Tickets are available in the Xojo store and if you bring your partner, you can order an extra guest ticket for the dinner events.

Check out the conference highlights video if you want to see what it's like - or ask one of the many attendees from the forum!

Wether you are full or part time Xojo developer, this is your chance to learn all about the Web 2.0 framework, the Android progress and what's new in the Xojo world.

MBS Xojo Plugins, version 20.1pr5

New in this prerelease of the 20.1 plugins:
  • Added EvaluateMT and CallFunctionMT methods to JavaScriptEngineMBS class.
  • Added SkipMode parameter to constructors for FileListMBS class to skip over files/folders and hidden items.
  • Disabled a warning from our own check code about data size of SQLDatabaseMBS class.
  • Fixed NameFieldStringValue in NSSavePanelMBS to properly set with empty text.
  • Updated SQLAPI to version 5.0.5.
  • Changed AbsolutePathMBS (and AbsolutePath) to return directory path with double colon.
  • Fixed problem with DynaPDF's graphics class integration on Windows 64-bit when running Xojo report to PDF.
  • Fixed a problem with recursive templates for ExtractPageText and ExtractPageTextRect functions in DynaPDFMBS class.
  • Added ExifThumbnail function to GM16ImageMBS and GMImageMBS class.
  • Added ExifThumbnail property to JPEGImporterMBS class.
  • Added Looping property to MFPMediaPlayerMBS class.
Download: monkeybreadsoftware.com/xojo/download/plugin/Prerelease/.
Or ask us to be added to our shared Dropbox folder.

MBS FileMaker Plugin, version 10.1pr5

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.

Reading JPEG Thumbnails from EXIF

For next MBS Xojo Plugins we add new methods to JPEGImporterMBS class to read thumbnail from EXIF data in a JPEG file. This allows you to very quickly get a thumbnail image. We support ScaleFactor property for some years now, which allows you to read a JPEG scaled down and get only the pixel data decompressed you need. We use this often for a preview. The time differences may be for a test image here: 5.6 milliseconds for the thumbnail at 160x120, 64 milliseconds for a preview at 504x378 and 276 milliseconds for full image at 4032x3024 pixels. So in your projects, if you need to show JPEGs quickly, you may first check for a thumbnail, then for a scaled down preview and only if user double click the entry load the whole picture.

Here some sample code:

Dim file As FolderItem = SpecialFolder.Desktop.Child("test.jpg") // first read header and check for thumbnail in EXIF Dim j As New JPEGImporterMBS j.file = file j.ReadExifData = True If j.ReadHeader Then Dim thumbnailData As String = j.ExifThumbnail If thumbnailData.LenB > 0 Then thumbnailPic = picture.FromData(thumbnailData) End If // now read a scaled down image Dim factor As Double = Min( j.Height / 300.0, j.Width / 300.0) If factor >= 8.0 Then j.ScaleFactor = 8 Elseif factor >= 4.0 Then j.ScaleFactor = 4 Else j.ScaleFactor = 2 End If j.Import Pic2 = j.Picture // finally read full image j.ScaleFactor = 0 j.Import Pic3 = j.Picture Else MsgBox j.ErrorMessage End If
Coming soon for MBS Plugins version 20.1pr5. See also CGImageSourceMBS class for MacOS to get quickly thumbnails for various image formats.

Heute anmelden zur Deutschen FileMaker Konferenz 2020 in Malbun

Bis heute gilt der Frühbuchertarif zur elften deutschsprachigen FileMaker Konferenz 2020 in Malbun (Liechtenstein), vom 17. bis 20. Juni 2020 28. bis 31. Oktober 17. bis 19. Juni 2021 22. bis 24. Juli 2021 . Wer noch nicht angemeldet ist, sollte eventuell heute buchen und ein Hotelzimmer reservieren. Aktuell gibt es nur noch ein paar freie Zimmer in Malbun und wer die verpasst, müsste weite weg übernachten und morgens zur Konferenz per Auto oder Bus fahren.

Die Veranstalter vom Verein FM Konferenz erwarten auch 2020 rund 120 Entwickler, Anwender, IT-Fachleute und Entscheidungsträger aus Wirtschaft, Bildung und Verwaltung. Rund um über 20 Fachvorträge und Workshops wird es viel Zeit zum Vernetzen in den gemeinsamen Pausen und beim Abendprogramm geben.

Für den Deutschsprachigen Raum ist diese Konferenz das Treffen des Jahres. Hier finden Sie vom Anfänger bis zum Profi Kontakte zu anderen Entwicklern. Lernen Sie was es neues gibt, nehmen Sie Impulse mit für die eigene Arbeit und erfahren Sie mehr zu FileMaker von deutschsprachigen Experten!

Die MBS Plugin Schulung vorher findet am 17. Juni 2020 16. Juni 2021 21. Juli 2021 statt (im gleichen Hotel).

Bitte planen Sie wenigstens einen extra Tag ein für ihren Besuch in Liechtenstein, damit Sie die Natur in dem schönen Tal geniessen können. Den Aufstieg auf den Sareis können Sie bequem zu Fuß vom Hotel aus starten und die Turnastraße hinauf spazieren bis zum Restaurant am Gipfel. Oder alternativ die Seilbahn nehmen.



Interesse an mehr? Die Claris Engage Europe 2020 vom 26. bis 28. Oktober 2020 bietet deutlich mehr Vorträge, mehr internationale Teilnehmer und vor allem FileMaker Mitarbeiter aus den USA, die gerne mal einen Blick unter die Haube von FileMaker bieten.

Programming your own Solar System with Xojo + MBS SceneKit

Stefanie wrote another blog post for the official Xojo blog:



Programming your own Solar System with Xojo and MBS SceneKit

If you join Xojo Connect conference next month, please come to Stefanie's presentation: Scenekit - Stefanie Juchmes, 4 pm on 26th March. Please don't hesitate to send us questions.

Signed up as sponsor for Claris Engage 2020

Monkeybread Software signed up as a conference sponsor for the upcoming Claris Engage conference in Nashville, USA.

Details for the conference including the new website should be online early March, but please mark the dates in the calendar and keep the week available. Check out the Gaylord Opryland Resort & Convention Center website today.



Claris International Inc. hosts the Claris Engage conference in Nashville, August 3-6 2020.
We will attend and have a booth as usual, so see you there!

Upgrading WebKit for Windows support

As you may have seen Xojo 2019r3 uses a newer version of Chromium Embedded Framework for WebKit support on Windows. For us this means we have to put the upgrade of our Chromium plugin classes on the todo list.

For MBS Xojo Plugins 20.1 we upgrade our Chromium classes. You can try it with the recent 20.1pr4 pre-release version.

The changes include a few fixes for ChromiumCookieManagerMBS and ChromiumWebPluginInfoMBS class which both had crashing bugs, but seem to work fine now. You guys can be happy to use a high level language like Xojo where the compiler always makes sure your delegates have the right parameters as any mismatch can cause hard to track bugs later. Luckily we fixed it and now leverage C++ compiler to test those, too.

With newer plugin you can use Chromium with all Xojo versions since the introduction of WebKit support. We now support 3 different versions of the Chromium Embedded Framework used by Xojo with the same plugin. When you start using the plugin classes, we check which CEF version is used and use the right function pointers. Enjoy!

MBS Xojo Plugins, version 20.1pr4

New in this prerelease of the 20.1 plugins: Download: monkeybreadsoftware.com/xojo/download/plugin/Prerelease/.
Or ask us to be added to our shared Dropbox folder.

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?

Multithreaded plugin functions can increase speed of Xojo application

Have you seen the "NSImageMBS multithreading" or "Threaded Encryption and Hashes" example projects in Xojo?


Do you notice that with 4 Xojo threads, the plugin can actually get 4 CPU cores busy and get work done faster?

Over the last releases we added quite a few MT methods. Those are plugin methods which perform work on a preemptive thread. The Xojo thread calling them yields CPU time to other threads while it waits for the preemptive thread to finish work. And if you use several threads in Xojo already, this will help you keep more CPU cores busy. (more)

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.

Building slides for Xojo.Connect

As a speaker you should now take the time to prepare slides a month before the XOJO.CONNECT conference in Nashville, Tennessee, USA.
What is your favorite MBS Plugin feature from the last 12 months we should highlight?



It will be held March 25-27, 2020 in Nashville, TN at the Sheraton Music City Hotel. This conferences is the best place to meet Xojo developers from around the world in real live, make contacts, present yourself as expert and learn what is new in Xojo. Tickets are available in the Xojo store and if you bring your partner, you can order an extra guest ticket for the dinner events.

Check out the conference highlights video if you want to see what it's like - or ask one of the many attendees from the forum!

Wether you are full or part time Xojo developer, this is your chance to learn all about the Web 2.0 framework, the Android progress and what's new in the Xojo world.

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.

MBS Xojo Plugins, version 20.1pr3

New in this prerelease of the 20.1 plugins: Download: monkeybreadsoftware.com/xojo/download/plugin/Prerelease/.
Or ask us to be added to our shared Dropbox 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.

PS: Updated blog post here.

Customized File Open and Save Dialogs for Windows

This week, I learnt a lot about the APIs from Microsoft for open and save dialogs. For Xojo we got new WinFileOpenDialogMBS and WinFileSaveDialogMBS classes. Both are based on WinFileDialogMBS class and report errors via WinFileDialogExceptionMBS. To return items, we use WinShellItemMBS class and WinShellItemArrayMBS for a list of items. To define file types, we got the WinFileTypeMBS class. The dialog may look like this:



We customized the title, the OK button, the label for the file name and added a list of file types to fill the file types popup menu. As you see there are custom controls on the dialog with two text fields and a checkbox with a popupmenu below. We added a lot of events for the WinFileDialogMBS class, so you not just learn about changed selections, folder changes, but also about events to custom controls. In the CheckButtonToggled event as an example we can react on the checkbox and enable/disable the popupmenu below.

While most people are happy with the built-in OpenFileDialog and SaveFileDialog classes, our plugin classes offer many more features for Windows specific projects. Please check NSOpenPanelMBS and NSSavePanelMBS classes for MacOS to do similar things. And we still have OpenDialogMBS as a cross platform class.

The example project with a lot of settings:



Please try soon with next prerelease of MBS Xojo Plugins 20.1.

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.

MBS Xojo Plugins, version 20.1pr2

New in this prerelease of the 20.1 plugins: Download: monkeybreadsoftware.com/xojo/download/plugin/Prerelease/.
Or ask us to be added to our shared Dropbox 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.

Airplay related classes for AVFoundation

For MacOS, we add AVRouteDetectorMBS class to detect if multiple routes are available, e.g. for Airplay.
And for MacOS 10.15 we add AVRoutePickerViewControlMBS control to show the standard control from Apple to select the output device:



If you have an Airplay enabled device, it should show up in the popup menu.
Our example project uses AVRouteDetectorMBS class to detect if multiple routes are available. If that is true, we show the AVRoutePickerViewControlMBS control and let the user pick the destination for the current video player.

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

17 Years Xojo Developer Magazine

Did you notice that over the last 17 years we got 103 issues of the Xojo developer magazine?



As you know the magazine is more up to date than any book and we highly recommend a subscription for all Xojo developers. Keep up to date on news, development best practice and learn tips and tricks.

Today you get all 103 back issues with 7360 pages in total including 400 pages mentioning MBS classes, modules or controls. Check the Welcome to Xojo bundle for new users.

You need a subscription? Contact us via form before 5th Feb 2020 to win one of three short subscriptions (3 issues).

Archives

Mar 2024
Feb 2024
Jan 2024
Dec 2023
Nov 2023
Oct 2023
Sep 2023
Aug 2023
Jul 2023
Jun 2023
May 2023
Apr 2023
Mar 2023
Feb 2023
Jan 2023
Dec 2022
Nov 2022
Oct 2022
Sep 2022
Aug 2022
Jul 2022
Jun 2022
May 2022
Apr 2022
Mar 2022
Feb 2022
Jan 2022
Dec 2021
Nov 2021
Oct 2021
Sep 2021
Aug 2021
Jul 2021
Jun 2021
May 2021
Apr 2021
Mar 2021
Feb 2021
Jan 2021
Dec 2020
Nov 2020
Oct 2020
Sep 2020
Aug 2020
Jul 2020
Jun 2020
May 2020
Apr 2020
Mar 2020
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