PDFKit on iOS for MBS FileMaker Plugin

As Apple added support for PDFKit to iOS with version 11, we thought we may use it for FileMaker, too.

And indeed, our PDFKit functions can work on iOS, too. Printing is not available and Quartz Filters are macOS only.
But other functions like rendering a PDF page or merging several PDFs into one works well.

So you can now do PDF append operation on iOS with our plugin, e.g. using PDFKit.AppendPages function. The following scripts merges two PDFs and stores the resulting PDF in a new container:

Set Variable [ $pdf ; Value: MBS("PDFKit.OpenContainer"; MyTable::InputPDF) ]
Set Variable [ $r ; Value: MBS( "PDFKit.AppendPages"; $pdf; MyTable::OtherPDF ) ]
Set Field [ MyTable::OutputPDF ; MBS( "PDFKit.GetPDFDocument"; $PDF) ]
Set Variable [ $r ; Value: MBS( "PDFKit.Release"; $pdf) ]

You can of course decide whether you like to use PDFKit or you need more and use our DynaPDF functions. With DynaPDF we have a cross platform library which provides constant behavior on all platforms. PDFKit is great for the average user, but if you need PDF/A, separation/process colors or optimization, you need more. See DynaPDF features.

The new features can be tested with the upcoming beta version in a few days. If you like to try them earlier, please do not hesitate to contact us.

Amazon S3 Upload with Mime Type and Permissions

As you may know we have functions to do authentication for Amazon WebServices in our plugins for Xojo and FileMaker. This functions can be used with various webservices from Amazon, but today we use S3 as example and upload an image from a container.

You can pass additional headers with the upload to specify permissions and content type. For example you can grant permissions to everyone with acl public-read. When you pass the content type, you get back that same content type when downloading. Here an example upload:

# Change to your own credentials, region, bucket name, file name...

Set Variable [ $AWSAccessKeyId ; Value: "AKIAK21ZENQFJ3EFLKJA" ] 

Set Variable [ $AWSSecretAccessKey ; Value: "4TMeKFtn62xDfAP6F1cENwHehRqo75kQKoT/BAKE" ] 

Set Variable [ $Region ; Value: "eu-central-1" ] 

Set Variable [ $Bucketname ; Value: "mbstest" ] 

Set Variable [ $Filename ; Value: "test.jpg" ] 

Set Variable [ $Headers ; Value: "Content-Type: image/jpeg¶x-amz-acl: public-read" ] 

Set Variable [ $Service ; Value: "s3" ] 

Set Variable [ $Verb ; Value: "PUT" ] 

# Keep those empty for default

Set Variable [ $Domain ; Value: "" ] 

Set Variable [ $HashedPayload ; Value: "" ] 

# Build a path

Set Variable [ $Path ; Value: "/" & $BucketName & "/" & $Filename ] 

# Run transfer

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

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

Set Variable [ $result ; Value: MBS("CURL.SetupAWS"; $curl; $AWSAccessKeyId; $AWSSecretAccessKey; $Region; $Service; $Path; $Domain; $Verb; ""; $Headers) ] 

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

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

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

Same upload works in Xojo with our MBS Xojo CURL Plugin

Please do not hesitate to contact us with questions.


Print WebViewer on macOS in FileMaker

Today an user send us a script which does printing of a webviewer with some report (in HTML) to a PDF file. The code works pretty well and prints automatically dozens of reports to PDF files:

# Check plugin version installed to use right key

Set Variable [ $_MBS_Version ; Value: MBS("Version") ] 

Set Variable [ $_MBS_Version_asNumber ; Value: Substitute ( GetAsNumber ( $_MBS_Version ) ; "?" ; 0 ) ] 

If [ MBS("isRegistered") ≠ 1 ] 

If [ $_MBS_Version_asNumber >= 7 ] 

# Version 7 with newer code

Set Variable [ $_MBS ; Value: MBS("Register"; "ABC"; "Complete"; "5 seats"; 201803; "###") ] 

Else

# Version 6 with older code

Set Variable [ $_MBS ; Value: MBS("Register"; "ABC"; "Complete"; "5 seats"; 201702; "xyz") ] 

End If

End If

# Destination file path, could be a parameter to the script.

Set Variable [ $_Path_Destination_Complete ; Value: "/tmp/test.pdf" ] 

# Page to load and print

Set Variable [ $URL ; Value: "https://www.mbsplugins.de" ] 

# Check plugin version needed for FileMaker 16

If [ GetAsNumber ( Get(ApplicationVersion) ) >= 16 and $_MBS_Version_asNumber < 7,4 ] 

Show Custom Dialog [ "Process: Error" ; "Filemaker 16 or greater requires MBS Plugin version 7.4 or higher." ] 

Halt Script

End If

# Set print parameters

Set Variable [ $_MBS ; Value: MBS( "WebView.SetPrintParameter"; "topMargin"; 0 ) ] 

Set Variable [ $_MBS ; Value: MBS( "WebView.SetPrintParameter"; "bottomMargin"; 0 ) ] 

Set Variable [ $_MBS ; Value: MBS( "WebView.SetPrintParameter"; "leftMargin"; 0 ) ] 

Set Variable [ $_MBS ; Value: MBS( "WebView.SetPrintParameter"; "RightMargin"; 30 ) ] 

If [ $_MBS_Version_asNumber >= 7,4 ] 

Set Variable [ $x ; Value: 0 ] 

Set Variable [ $y ; Value: 100 ] 

Set Variable [ $w ; Value: 970 ] 

Set Variable [ $h ; Value: 440 ] 

# Create a webviewer via plugin to use older WebKit which can print

Set Variable [ $$web ; Value: MBS("Webview.Create"; 0; $x; $y; $w; $h) ] 

Set Variable [ $error ; Value: MBS("IsError") ] 

If [ $error = 0 ] 

# Load URL

Set Variable [ $_MBS ; Value: MBS( "WebView.LoadURL"; $$web; $URL) ] 

# Wait for loading

Set Variable [ $_WebViewer_isLoading ; Value: True ] 

Loop

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

Exit Loop If [ MBS( "WebView.IsLoading"; $_theWebViewerID ) ≠ 1 ] 

End Loop

# print webviewer

Set Variable [ $_MBS ; Value: MBS( "WebView.PrintToFile"; $$web ; $_Path_Destination_Complete ) ] 

Set Variable [ $error ; Value: MBS("IsError") ] 

# close webviewer

Set Variable [ $r ; Value: MBS( "WebView.Close"; $$web) ] 

End If

Else

# Print WebViewer Contents to tmp folder

Set Variable [ $_theWebViewerID ; Value: "web" ] 

# print webviewer

Set Variable [ $_MBS ; Value: MBS( "WebView.PrintToFile"; $_theWebViewerID ; $_Path_Destination_Complete ) ] 

Set Variable [ $error ; Value: MBS("IsError") ] 

End If

If [ $error ] 

Show Custom Dialog [ "Process: Error" ; List ( "Failed to save file [" & $_Path_Destination_Complete & "]" ; MBS("Text.RemovePrefix"; $_MBS… ] 

Halt Script

End If

 

As you see they use either an existing WebViewer on the layout or use the plugin provided one if possible. As WebKit 2.x does not print, but FileMaker 16 only uses the new version, we have to make a webviewer ourselves via plugin functions using older WebKit 1.x.


MBS FileMaker Plugin 7.5 - More than 5000 Functions In One Plugin

Nickenich, Germany - (November 28th, 2017) -- MonkeyBread Software today is pleased to announce MBS FileMaker Plugin 7.5 for macOS, iOS, Linux and Windows, the latest update to their product that is easily the most powerful plugin currently available for FileMaker Pro. As the leading database management solution for Windows, macOS, iOS and the web, the FileMaker Pro Integrated Development Environment supports a plugin architecture that can easily extend the feature set of the application. MBS FileMaker Plugin 7.5 has been updated and now includes over 5000 different functions, and the versatile plugin has gained more new functions:

Our new shell functions allow you to run other applications in the background on macOS, Windows and Linux. You can pass command line parameters, read output messages and send input text to the application. Your script can either wait for the results or you just let the application run in background and get a script triggered when the job is done. You can use various command line tools in FileMaker this way like scripts written in python or unpacking a tar archive.

The Regular expression functions can now do replace and replace all operations. You can search for a pattern, capture various texts and use the captured findings in the output text. Our new quote function helps you to escape texts for use in regular expressions.

We added the possibility to create trial license keys. This is a mode between demo mode (no license) and licensed mode. Trials are time limited and only for testing the plugin without demo dialogs. When trial ends, the plugins fall back to demo mode including any deployed solution.

Our DynaPDF functions can now replace images and you can provide replacement ICC profiles via container fields.

The syntax coloring functions got updated with a couple of bug fixes. Especially the functions like script search and script colors should now work on macOS High Sierra. We got new commands to hide/show scripts and scripts steps in the script workspace window. You can search in a script by a script and hide/show layout IDs.

For editing word files, we added functions to append to another word document. For form fields in your document, you can now list those fields, query values and set them.

When using the FileMaker iOS SDK, you can now fully use the JavaScript functions without WebViewer. CoreLocation and CLGeocoder functions are now available to query device location.

For Linux version running on FileMaker cloud we fixed an importing linking bug, so we now always use our own libraries and not the ones provided by FileMaker itself. So SFTP via CURL now works again. We can now also store registration key in local file on cloud server, so registration is not needed in scripts.

The OCR engine can now run in number only mode and writing OCRed text to PDF can now reduce font size to match original text width.

We added a help menu entry for MBS Plugin, JSON handling for 64-bit integers, list dialog sorting, better tracing, socket functions for multicast and change dock image for a window.

Finally we updated CURL library to version 7.56.0, DynaPDF to 4.0.14.39, LCMS to 2.9 and SQLite to 3.20.1.

See release notes for a complete list of changes.

MBS FileMaker Plugin 7.5 - Über 5000 Funktionen in einem Plugin

28. November 2017 - Monkeybread Software veröffentlicht heute das MBS Plugin für FileMaker in Version 7.5, mit inzwischen über 5000 Funktionen eines der größten FileMaker Plugins überhaupt. Hier einige der Neuerungen:

Unsere neuen Shell Funktionen erlauben Ihnen andere Programme im Hintergrund auszuführen auf macOS, Windows und Linux. Sie können Kommandozeilenparameter übergeben, die Ausgaben abfangen und Eingaben senden. Ihre Skripte warten entweder auf die Ergebnisse oder das Programm läuft im Hintergrund und Sie bekommen einen Skriptaufruf, wenn die Aufgabe fertig ist. Sie können damit verschiedene Kommandozeilenwerkzeuge einsetzen, zum Beispiel ein Skript in Python aufrufen oder ein Tar Archiv auspacken.

Die Funktionen für reguläre Ausdrücke können jetzt auch Texte ersetzen. Sie können nach einem Muster suchen, Texte erfassen und bei der Ausgabe wieder verwenden. Unsere neue Quote Funktion erlaubt es Texte zur Verwendung in regulären Ausdrücken vorzubereiten.

Mit dieser Version können wir jetzt Trial Lizenzen ausstellen. Das ist ein neuer Modus zwischen Demo (ohne Lizenz) und einer gekauften Lizenz. Trials sind limitiert in der Dauer und erlauben das Testen des MBS Plugins ohne Hinweise auf eine fehlende Lizenz. Am Ende der Zeit läuft das Plugin dann wieder im Demo Modus.

Unsere DynaPDF Funktionen können nun Bilder austauschen und Sie können Ersatz ICC Profile über Containerfelder angeben.

Die Farben für Skripte und Berechnungen wurden verbessert und funktionieren jetzt mit macOS High Sierra. Wir haben neue Befehle um den Bereich Skripte und den Bereich Skriptschritte per Skript ein/aus zu blenden. Genauso kann ein Skript die Suche im Skript triggern oder Layout IDs an/ausblenden.

Zum Editieren von Worddateien haben wir neue Funktionen um den Text in eine andere Worddatei anzuhängen. Formularfelder in Word Dateien können wir jetzt auflisten, auslesen und ausfüllen.

Für ihre iOS Anwendungen mit dem FileMaker iOS SDK können Sie jetzt JavaScript auch ohne Webviewer verwenden. Mit den CoreLocation und CLGeocoder Funktionen können den Standort des Geräts rausfinden.

Für die Linux Version des Plugins für die FileMaker Cloud haben wir ein Problem beim Linken behoben, so dass wir immer auf unsere eigenen Bibliotheken zugreifen und nicht mehr die von FileMaker verwenden. Daher funktioniert jetzt SFTP mit den CURL Funktionen wieder. Außerdem können wir die MBS Plugin Lizenz jetzt auch dauerthaft speichern anstatt das Plugin immer per Skript zu registrieren.

Die OCR Texterkennung kann jetzt auch im Zahlenmodus arbeiten und folglich nur Zahlen erkennen, wenn das erforderlich ist. Bei der Ausgabe des erkannten Textes in ein PDF Dokument passen wir die Schriftgröße jetzt dynamisch an, damit der Text immer die richtige Breite hat.

Wir haben neue Einträge für das Hilfemenü für das MBS Plugin, die JSON Funktionen arbeiten besser mit 64-bit Zahlen, der Listendialog lässt sich sortieren, das Tracing schreibt bessere Logdateien, die Socket Funktionen erlauben Multicast und Sie können das Dock Icon für jedes Fenster festlegen.

Außerdem haben wir die CURL Bibliothek auf Version 7.56.0 aktualisiert, DynaPDF auf Version 4.0.14.39, LCMS auf Version 2.9 und SQLite auf Version 3.20.1.

Alle Änderungen in den Release Notes.

MBS FileMaker Plugin, version 7.5pr9

New in this prerelease of the 7.5 MBS FileMaker Plugin:
  • Improved speed of some routines to avoid black script list in workspace. Due to delay, macOS didn't wait for drawing to finish and showed black buffer.
  • Enabled CoreLocation and CLGeocoder functions for iOS.
  • Added WordFile.Append.
  • Changed ImageCapture to better handle device disconnect while scanning.
  • Changed PDFKit preview rendering for Mac to not rotate preview to be consistent to FileMaker showing the PDF.
  • Improved OCR.WriteToPDF to reduce font size if needed to make sure words are not too wide.
  • Added help menu entries for macOS to go to our website.
  • Added shell functions to asynchronous running where you get a script trigger when done.
Download at monkeybreadsoftware.de/filemaker/files/Prerelease/ or ask for being added to the dropbox shared folder.

DynaPDF Funktionen im MBS FileMaker Plugin

ThumbnailBei dem FileMaker Experience Event in der Schweiz habe ich eine kleine Präsentation über das MBS Plugin vorgetragen.

Das Video ist jetzt verfügbar: DynaPDF Funktionen für FileMaker
(Deutsch und 12:33 Minuten)

Falls Sie Fragen zum MBS FileMaker Plugin haben, melden Sie sich bitte bei uns.

Der nächste FileMaker Event wäre die MBS FileMaker Schulung am 7. Dezember bei der Denkform.

FileMaker Experience Event in der Schweiz

Für den 21. November 2017 organisierte die Medio-Ingeno AG den zweiten FileMaker Event in Meilen. Der erste war ja die FileMaker 16 Vorstellung und wir sind mal gespannt, ob es im Mai 2018 wieder einen Event zu FileMaker 17 gibt.



Mit über 50 Gästen war der Raum gut gefüllt und die die 6 kurzen Vorträge fanden reichlich Applaus. Die sechs Vorträge:
  • PDF Funktionen mit MBS Plugin und DynaPDF mit Christian Schmitz
  • iBeacons und FileMaker mit Alexis Gehrt
  • Adressen über GoogleMaps mit FileMaker abfragen (REST-API / JSON) mit Rico Meier
  • ScriptLog: Was der Debugger nicht kann mit Christian Sedlmair
  • Ergebnismenge in FileMaker zwischenspeichern (FoundSet) mit Martin Schwarz
  • FileMaker als Service-/Datenquelle (Data API) mit Christoph Dunkake
Viele nutzen die Möglichkeit Kollegen aus der Schweiz zu treffen und über aktuelles zu sprechen. Michael Valentin, Business Development Manager der FileMaker GmbH, stand für Fragen zur Verfügung und gab reichlich Auskunft.



Vor dem Abendevent hatte ich noch eine MBS Plugin Schulung angeboten. Wir haben uns einen Überblick Über das MBS Plugin verschafft und dann nachmittags ein Beispiel für die Dokumentenverwaltung zusammen gebaut. Unter anderem mit Anbindung von Flachbett bzw. Dokumenteneinzugsscanner mit ImageCapture (Mac) und WIA (Windows). Dazu dann noch OCR für die Texterkennung zur Volltextsuche und PDF Erstellung.

Wir freuen uns viele wieder zu sehen, eventuell Ende Mai, falls FileMaker wie angekündigt jetzt jedes Jahr eine neue Version raus bringt. Da die Cloud Update wohl eher alle 6 Monate kommen, sollte die Frühlingsversion bis dahin eventuell auch fertig sein. Und vermutlich haben wir im MBS FileMaker Plugin auch ein paar Frühlingsneuigkeiten zum Vorführen. Siehe fmnext.ch

Danke an das Team der Medio-Ingeno AG für die Organisation, Danke den Vortragenden für ihre Bemühungen, FileMaker für das Senden vom Michael Valentin und allen Teilnehmern für ihr Kommen.

MBS FileMaker Plugin, version 7.5pr8

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

Convert to MP3 with new Shell commands and ffmpeg

Today we provided an example to a FileMaker developer. The job is to convert the sound from a video (or audio) file to an mp3 file. As we recently got the new Shell functions, we can now use ffmpeg easily in FileMaker with a script like this: 

Set Variable [ $shell ; Value: MBS( "Shell.New" ) ] 

Set Field [ Shell::Output ; "" ] 

Set Field [ Shell::Error ; "" ] 

Commit Records/Requests [ With dialog: Off ] 

# Where the app is:

Set Variable [ $executable ; Value: "/Applications/ffmpegX.app/Contents/Resources/ffmpeg" ] 

# option: overwrite file

Set Variable [ $s ; Value: MBS( "Shell.AddArgument"; $shell; "-y" ) ] 

# option: input file

Set Variable [ $s ; Value: MBS( "Shell.AddArgument"; $shell; "-i" ) ] 

# Path to input file

Set Variable [ $InputFile ; Value: "/Users/cs/Desktop/movie.m4v" ] 

# and output file

Set Variable [ $OutputFile ; Value: "/Users/cs/Desktop/sound.mp3" ] 

# Run it!

Set Variable [ $s ; Value: MBS( "Shell.Execute"; $shell; $executable; $InputFile; $OutputFile) ] 

Set Variable [ $error ; Value: "" ] 

Set Variable [ $result ; Value: "" ] 

If [ MBS("IsError") ] 

Show Custom Dialog [ "Failed to run" ; $s ] 

Else

# Loop while app runs and collect messages

Loop

# Wait a second or till it quits

Set Variable [ $s ; Value: MBS( "Shell.Wait"; $shell; 1) ] 

# And read output

Set Variable [ $error ; Value: $error & MBS( "Shell.ReadErrorText"; $shell; "UTF-8") ] 

Set Variable [ $result ; Value: $result & MBS( "Shell.ReadOutputText"; $shell; "UTF-8") ] 

Set Field [ Shell::Error ; MBS( "Text.ReplaceNewline"; $error; 1) ] 

Set Field [ Shell::Output ; MBS( "Text.ReplaceNewline"; $result; 1) ] 

# exit when done

Exit Loop If [ MBS( "Shell.IsRunning"; $shell) ≠ 1 ] 

End Loop

# We are done

Commit Records/Requests [ With dialog: Off ] 

End If

Set Variable [ $r ; Value: MBS("Shell.Release"; $shell) ] 

As you see we prepare new shell and than you can loop and call Shell.Execute with the next input file. When launch works, we run a loop to wait for result and collect output from both channels, stdout and stderr. The messages are put in the fields and when the tool is done, we exit. The script is universel and can be used to run any shell tool on Mac, Windows and Linux. Just make sure the paths are correct.

The new Shell functions are coming with 7.5 release in the next weeks. You can try the beta today.

PS: Instead of wait, you can use also the FileMaker Pause Script Step to pause.


MBS Workshop in der Schweiz

Am 21. November 2017 findet eine MBS Schulung in Meilen am Zürichsee statt. Wir treffen uns ab 9 Uhr im Restaurant Löwen in einem separaten Schulungsraum. Nutzen Sie die Chance die 5000 Funktionen des MBS FileMaker Plugins kennen zu lernen und neue Ideen für Ihre FileMaker Lösungen mit zu nehmen.

Geplantes Programm:
  • Präsentation zum MBS Plugin mit einem Überblick über die Funktionalität.
  • Demonstration von neuen Funktionen in der Version 7.5 (beta).
  • Entwicklung einer Dokumentenverwaltung:
    • Scannen von Dokumenten mit verschiedenen Optionen, automatisch und mit Dialog.
    • Für Windows mit WIA Treiber
    • Für macOS mit ImageCapture Treiber
    • Ablage der gescannten Seiten
    • OCR der Seiten
    • Umwandlung in PDF Dokument mit PDFKit für Mac
    • Umwandlung in PDF Dokument mit erkanntem Text mit DynaPDF für Mac/Win/Linux
    • Ablage der PDFs mit Text für Volltextsuche
    • Suche in PDF Dokumenten
  • Web Formulare ausfüllen
    • Beispiel zum Ausfüllen von Formularen in einem Web Store als Arbeitserleichterung
    • JavaScript ausführen
  • Zeit für Fragen
Die Teilnahme kostet 150 Fr. und ist vor Ort zu bezahlen. Mittagessen im Restaurant inklusive.
Maximal 12 Teilnehmer. Anmeldung bei uns: Anmelden

Am gleichen Tag lädt die Medio-Ingeno AG zu einem FileMaker Event ein: fmnext.ch
Ab 17:30 Uhr gibt es im Gewölbekeller im Restaurant Löwen in Meilen ein buntes Programm mit Vorträgen zu FileMaker.

MBS Workshop @ Denkform

In Zusammenarbeit mit der DenkForm GmbH bieten wir eine Schulung zum MBS Plugin an. Am 7. Dezember 2017 (auch 1. März 2018) können Sie in Hofheim am Taunus an einer eintägigen Schulung teilnehmen. Lernen Sie die über 5000 Funktionen einmal näher kennen und wie Sie sie effektiv einsetzen. Sammeln Sie Ideen und verbessern Sie ihre FileMaker Lösungen durch den Einsatz unseres Plugins.

Das Monkeybread Software Plugin für FileMaker stellt eine vielseitige Erweiterung der eigenen Datenbank dar. Der Kurs bietet nicht nur einen tiefgreifenden Überblick in die Benutzung und Entwicklung, sondern bietet auch die Chance das Plugin günstiger zu erstehen.
  • Einführung in das MBS Plugin
  • Überblick über die Funktionsbereiche
  • Neues im MBS Plugin dieses Jahr und in der dann aktuellen Version 7.5
  • Rundgang durch ausgewählte Beispiele
  • Gemeinsames Implementieren von Plugin Funktionen in eine Datenbank:
  • Upload/Download mit CURL auf einen HTTP/FTP Server
  • Ausfüllen eines Formulares auf einer Webseite
  • Bilder bearbeiten
  • PDF Verarbeitung
  • Druckerfunktionen
  • Adressbuch und Kontakte abfragen bei Mac OS X.
  • Fragen und Antworten
Die Teilnahme kostet 99 Euro inkl. MWSt. und Verpflegung. Trainer ist der Plugin Entwickler und Monkeybread Software Geschäftsführer Christian Schmitz persönlich.

Details und Anmeldung bei der Denkform.

Im Anschluss besteht die Möglichkeit zum FileMaker Rhein-Main Stammtisch zu kommen. Bei einem leckeren Abendessen im Restaurant Bella Bari in der Nähe der Denkform können Sie sich mit anderen FileMaker Entwicklern aus der Gegend austauschen.

PS: Die Mindestteilnehmerzahl wurde erreicht und die Schulung am 1. März findet statt.

Parsing VCard file

Today we had a client who needed to read in VCard files. The following script shows an early version of the script which loops over the desktop folder to import VCF file. For testing there was only one file there, so we skipped creating record as we simply wrote always in the same record.
 

# Loop over files on desktop

Set Variable [ $folder ; Value: MBS( "Folders.UserDesktop" ) ] 

Set Variable [ $files ; Value: MBS( "Files.List"; $folder; 1+4; ".vcf" ) ] 

If [ MBS("IsError") = 0 ] 

Set Variable [ $count ; Value: ValueCount ( $files ) ] 

Set Variable [ $index ; Value: 1 ] 

If [ $count > 0 ] 

Loop

# Read in vcard

Set Variable [ $filename ; Value: GetValue($files; $index) ] 

Set Variable [ $filepath ; Value: MBS( "Path.AddPathComponent"; $folder; $filename ) ] 

Set Variable [ $text ; Value: MBS( "Text.ReadTextFile"; $FilePath; "UTF-8" ) ] 

If [ MBS("IsError") = 0 ] 

# Normalize end of line characters

Set Variable [ $text ; Value: MBS( "Text.ReplaceNewline"; $text; 1) ] 

# Create new record here

# Process all text lines

Set Variable [ $LineCount ; Value: ValueCount ( $text ) ] 

Set Variable [ $LineIndex ; Value: 1 ] 

Loop

Set Variable [ $Line ; Value: GetValue($text; $lineindex) ] 

If [ Left ( $line ; 2 ) = "N:" ] 

# Name

Set Variable [ $z ; Value: Middle ( $line ; 3; Length ( $line )) ] 

Set Variable [ $list ; Value: MBS( "List.CSVSplit"; $z ) ] 

Set Variable [ $FirstName ; Value: GetValue($list; 1) ] 

Set Variable [ $SureName ; Value: GetValue($list; 2) ] 

Set Field [ CON::nameGiven ; $firstName ] 

Set Field [ CON::nameFamily ; $sureName ] 

Else If [ Left($line; 6) = "EMAIL;" ] 

# todo

Else If [ Left($line; 27) = "PHOTO;ENCODING=b;TYPE=JPEG:" ] 

# Photo as base64 coded JPEG:

Set Variable [ $data ; Value: Middle ( $line ; 28; Length ( $line )) ] 

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

Loop

Set Variable [ $Line ; Value: GetValue($text; $lineindex) ] 

Exit Loop If [ Left ( $line ; 1 ) ≠ " " ] 

Set Variable [ $data ; Value: $data & ¶ & $line ] 

# next

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

Exit Loop If [ $LineIndex > $LineCount ] 

End Loop

Set Variable [ $LineIndex ; Value: $LineIndex - 1 ] 

Set Variable [ $image ; Value: Base64Decode ( $data; "image.jpg" ) ] 

Set Field [ CON::imageOrLogo ; $image ] 

End If

# next

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

Exit Loop If [ $LineIndex > $LineCount ] 

End Loop

# Commit record

End If

# next

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

Exit Loop If [ $index > $count ] 

End Loop

End If

End If

 
To look in detail, we use Files.List to list the files. Mode 4 for visible items only and 1 to limit to files. We loop over all file names and use Path.AddPathComponent to add file name to the folder path. For the text we read it and replace all end of line characters with the mac version. When we hit the name entry in the lines, we get the first and last name. For a photo we need to collect all the lines for base64 decode and than display image in container. 
The script is not yet ready and probably needs some more work to cover all keys, but it may be a good start for other people. 

MBS FileMaker Plugin, version 7.5pr7

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

5000 Functions in MBS Plugin

Last year in summer I reported we reached 4000 functions.

Only 17 months later I write documentation for the upcoming 7.5 release and just noticed that we hit the 5000 functions goal!

I don't want to list all 1000 functions we got since June 2016, but here the list of topics added in the creation order:

SmartCard, ImageCapture, Updater, Java, TouchBar, WIA, Certificates, AVPlayer, DirectoryWatcher, iOSDevice, Registry, WinSendMail, UNNotification, WindowsUserNotification, MailComposer, MessageComposer, SocialComposer, BinaryFile, ImagePicker, CoreImage, ScriptWorkspace, Debugger, ImageView, CoreML, iOSKeyboard, iOSApp and Shell.

Please take the time to checkout what functions we got there and maybe you can use a few of them in one of your projects? The new Shell functionality for macOS, Windows and Linux looks promising and may be a big help to run command line tools. (

FileMaker Experience Event in der Schweiz

In der Schweiz organisiert die Firma Medio-Ingeno einen FileMaker Experience Event für den 21. November 2017, 17.30 Uhr in Meilen am Zürichsee.

Mit folgenden Vorträgen:
PDF Funktionen mit MBS Plugin und DynaPDF, Christian Schmitz (MBS)
iBeacons und FileMaker, Alexis Gehrt (Database Designs)
Adressen über GoogleMaps mit FileMaker abfragen (REST-API / JSON), Rico Meier (Medio-Ingeno AG)
Ergebnismenge in FileMaker zwischenspeichern (FoundSet), Martin Schwarz (Medio-Ingeno AG)
FileMaker als Service-/Datenquelle (Data API), Christoph Dunkake (Medio-Ingeno AG)
ScriptLog: Was der Debugger nicht kann, Christian Sedlmair

Wir freuen uns, dass Michael Valentin, Business Development Manager der FileMaker GmbH dabei sein wird.

Link zu Programm und Anmeldung.
Falls jemand schon vorher da ist, sieht man sich vermutlich an der Bar oder im Restaurant.

MBS FileMaker Plugin, version 7.5pr6

New in this prerelease of the 7.5 MBS FileMaker Plugin:
  • Fixed issue in SQL functions with binding parameters for ODBC.
  • Fixed issue in SQL functions with getting text fields with FileMaker over ODBC.
  • Added trial licenses for better plugin evaluation.
  • Fixed problem with XML.Import and CData nodes.
  • Added SystemInfo.isHighSierra function.
  • Fixed script search for High Sierra.
  • Fixed script coloring for High Sierra.
  • Fixed script if/loop block highlighting for High Sierra.
  • Fixed an issue with XML.GetPathValue not finding right nodes.
  • Added OCR.GetVariable and OCR.SetVariable functions, e.g. to enable number only mode.
  • Changed ZipFile.CreateFile to replace backslash in file path with slash to avoid errors.
Download at monkeybreadsoftware.de/filemaker/files/Prerelease/ or ask for being added to the dropbox shared folder.

SyntaxColoring in FileMaker for macOS High Sierra coming

For the next MBS FileMaker Plugin prerelease, I got the syntax coloring fixed for macOS High Sierra:



As you see the if/loop highlighting in blue, the search in yellow and the general colorization works well.
If you like to test, please download the new beta in the next days or email me for a copy today.

Import Calendar Items into FileMaker

Today I had a talk with a client who needed the following script to import events from a calendar. The idea is that he makes this appointment in the Calendar app on the iPhone and later on the Mac he wants to import all new events:

 

# Calendar name/id is passed as parameter

Set Variable [ $calendar ; Value: Get(ScriptParameter) ] 

If [ $calendar = "" ] 

Exit Script [ Text Result:    ] 

End If

# Date Range fixed

// Set Variable [ $startTimestamp ; Value: Timestamp(Date ( 1 ; 1 ; 2015 ); Time ( 0 ; 0 ; 0 )) ] 

// Set Variable [ $endTimestamp ; Value: Timestamp(Date ( 7 ; 1 ; 2012 ); Time ( 0 ; 0 ; 0 )) ] 

# Date Range relative to today and three years back

Set Variable [ $endTimestamp ; Value: Get(CurrentTimestamp) ] 

Set Variable [ $startTimestamp ; Value: $endTimeStamp - 365 * 3 * 24 * 60 * 60 ] 

# Query events

Set Variable [ $events ; Value: MBS("Calendar.Events"; $startTimeStamp; $endTimeStamp; $calendar) ] 

If [ MBS("IsError") = 0 ] 

# go to the layout

Go to Layout [ “Shoot” (Shoot) ; Animation: None ]

# loop over events

Set Variable [ $count ; Value: ValueCount ( $events ) ] 

Set Variable [ $index ; Value: 1 ] 

Set Variable [ $RecordsCreated ; Value: 0 ] 

Loop

Set Variable [ $id ; Value: GetValue($events; $index) ] 

Set Variable [ $uid ; Value: MBS("Calendar.Item.GetUID"; $id) ] 

# Check for duplicates

If [ MBS("FM.ExecuteFileSQL"; ""; "SELECT count(*) FROM Shoot WHERE CalendarItemID=?"; 9; 13; $UID) ≠ 1 ] 

# New ID, so create record

New Record/Request

Set Field [ Shoot::Date ; GetAsDate(MBS("Calendar.Item.GetStartDate"; $id)) ] 

Set Field [ Shoot::Time ; GetAsTime(MBS("Calendar.Item.GetStartDate"; $id)) ] 

Set Field [ Shoot::Location ; MBS("Calendar.Item.GetLocation"; $id) ] 

Set Field [ Shoot::Event ; MBS("Calendar.Item.GetTitle"; $id) ] 

Set Field [ Shoot::CalendarItemID ; $uid ] 

Commit Records/Requests [ With dialog: Off ] 

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

End If

# next

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

Exit Loop If [ $index > $count ] 

End Loop

Show Custom Dialog [ "Done" ; $RecordsCreated & " of " & $count & " items imported for " & $calendar ] 

End If

 

As you see, we got a duplicate check via SQL to skip all IDs we had before. Of course you can change it to synchronize in one direction if needed.

 

Using MBS FileMaker Plugin you can import, create and modify calendar items and reminders. Please note, that we have two ways to do this: Calendar functions works for 32 and 64-bit macOS, so you can use it in FileMaker 12 (32-bit) for example. The newer Events functions are for 64-bit macOS and for iOS SDK and should be preferred for new projects unless you need older FileMaker versions.


Video to show CoreML functions in MBS Plugin

CoreML in FileMaker

Presentation video about a Core ML database for image detection.

Showing the use of machine learning in a FileMaker database to classify images using a CoreML model.

If you have macOS High Sierra, you can download the model, example database and try it yourself.

Same can be done in Xojo with our CoreML plugin classes.
Requires macOS High Sierra or iOS 11 to work.


MBS FileMaker Plugin, version 7.5pr5

New in this prerelease of the 7.5 MBS FileMaker Plugin:
  • Added number sort mode for List.Sort.
  • Switched to Xcode 9.1.
  • Added flag for JSON.GetPathItem to avoid returning error for missing keys.
  • Fixed linking problem on Linux which made loader connect our plugin with FM's libraries instead of our own. CURL with SFTP works again.
  • Changed plugin to return booleans as numbers to work around bug in FileMaker with handling boolean results (Product Issue #711010).
  • For some script triggers like Hotkeys we can now query file name with Get(FileName) if empty filename is passed and call script in current file.
Download at monkeybreadsoftware.de/filemaker/files/Prerelease/ or ask for being added to the dropbox shared folder.

CSV functions in MBS FileMaker Plugin

If you need to work with CSV data in FileMaker, the MBS FileMaker Plugin has four functions which may be interesting for you.

First, to get CSV data to export, you can use FM.SQL.Execute to run a SQL query. In the query, you can name the columns you need. With clever expressions you can cast them to data type you need, or concat values as needed. In the where clause you can select which data you need. For example this query looks up first and last name, includes an ID 123 and concats zip and city name to one field. Finally it does ordering with descending order:

$records = MBS("FM.SQL.Execute"; ""; "SELECT \"FirstName\", \"LastName\", '123', \"Zip\"+ ' ' + \"City\" FROM Addresses WHERE City=? ORDER BY LastName DESC"; "New York")

Than you have the records in a handle and with FM.SQL.Text function you can query all or just a part of the rows. You can configure which row and column separators to use. With Text.WriteTextFile you can write the text to a file if needed.

Second, when you have CSV data, you can use List.CSVSplit or QuickList.CSVSplit to split a line of CSV data and auto detect the delimiter. This allows you to process line by line in a text file and do something useful.

Third, to simply import CSV data into records, you can use our FM.InsertRecordCSV function. There we take a block of text to split it in lines and each line with the List.CSVSplit internally into the values. You pass in file name, table name and field names, so we can build the SQL functions for you and do the insert statements.

Archives

Sep 2025
Aug 2025
Jul 2025
Jun 2025
May 2025
Apr 2025
Mar 2025
Feb 2025
Jan 2025
Dec 2024
Nov 2024
Oct 2024
Sep 2024
Aug 2024
Jul 2024
Jun 2024
May 2024
Apr 2024
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
Mar 2010
Dec 2009
Nov 2009