The happy new plugin family of 1.8.0.6
We have exciting news today: the release of the new ACF Plugin for InDesign and ACF Plugin for 4D, in addition to a new release of the FileMaker plugin.
All three versions of the plugin can execute the same ACF code. There are, of course, some differences depending on what is possible in each host platform.
Common to all three versions is support for business logic, workflow automation, connections to external APIs, data manipulation, report generation, Excel, PDF, and traditional CSV exports. They can also generate images on the fly, including QR codes and barcodes.
FileMaker and 4D both have their own scripting or programming language. For those platforms, most ACF functions extend the host environment with new developer-defined functions written in the ACF language.
As I have discovered, Codex from OpenAI is excellent at ACF programming work. It can help you produce the functions you need for your implementation. We have reference material available on our website that can be downloaded and unpacked into the workspace folder for your project. Ask Codex to read the reference before doing any ACF work. Once that is done, you have an ACF coding coworker ready to assist.
Adobe InDesign

InDesign does not have a built-in user-programmable language in the same way, so here the ACF language becomes the programming language for InDesign. However, Indesign has a scripting language (JavaScript). In this version we have included ability to call Scripts and also from the Scripts to call ACF functions. The ACF packages containing the user functions can define menus, palettes, and more. They can improve the workflow in the production phase of materials, newspapers, magazines, or ads by connecting to databases, file systems, remote servers, and other services.
The ACF package defines menu items. The connected ACF functions execute and prepare a JSON object, which is returned to the plugin. This object defines the commands and actions the plugin uses to complete the task, such as placing objects in the document.
Actions can be:
- open or create new documents
- retrieve content for the document, such as images and text, from the file system, an external API, an external database, and more.
- return instructions to the plugin for issuing commands to InDesign, for example placing objects at predefined or calculated positions.
- open palettes or dialogs.
- operate a local database using SQLite, or a remote MySQL database directly.
- generate images using the image drawing functions in the plugin, for placement in the InDesign document.
- Execute Script functions
- Let Scripts call ACF functions, or Call ACF functions and Dispatch the result to the plugin engine to carry out commands based on the returned JSON structure.
4D

4D has its own powerful programming language. What makes ACF Plugin useful here is the collection of modules: a standardized SQL engine that makes SQL similar across 4D SQL, MySQL, and SQLite; advanced API functions; styled Excel export and import; Excel charts; PDF generation; image generation; QR codes; and much more. Last but not least, the vast amount of free ACF library functions and example code now runs on 4D too. AS the ACF reference is valid for 4D implementation too, there is a separate section devoted to 4D implementation that show the calling methods and any differences:
https://horneks.no/manuals/ACF/acf-pluginiscomingto4d.html
and:
https://horneks.no/manuals/ACF/acffor4d-externalfunctions.html
FileMaker

This is where it all started, 15 years ago. Instead of custom functions that are parameterized calculations, some functions benefit from a more procedural algorithm for solving the task. For example: for-loops and structured conditional statements. Standard custom functions have If and Case, but they cover calculations, not a structural body of statements. More and more functionality has been added to the plugin since version 1.0, and now up to 1.8.0.5. In fact, here at the office, when doing FileMaker work, more functionality is developed using ACF than by scripting FileMaker scripts.
New Features in 1.8.0.6
Perform Javascript directly from the plugin.
No need for WebViewer fields. The Javascript libraries are loaded into the plugin memory and ready to be executed along with ACF functions. They can call each other both ways.
SQLite Local SQL databases
SQLite is a local database engine that can be used for portable databases. You can create or open a database from an ACF function, query it, insert or update records, alter its schema, and more. To make it easy to define the schema, we have set up the drawDB web app on our site. We have also added two new schema exports for SQLite: Export ACF-JSON and Export ACF-Source. The last one produces an ACF function that creates the JSON you can use to create the database. drawDB is a great web app that also handles other SQL flavours, such as MySQL. You can draw a relationship graph, define tables, fields, indexes, and more in a graphical user interface. You can also import from standard SQL and a few other formats to quickly build the database definition you need for your ACF functions.
We have kept drawDB as an open source project without rebranding it; we have only added our new exports.
Everything is stored locally. Nothing is sent to the server.
You can read more about the SQLite implementation in our reference.
https://horneks.no/manuals/ACF/sqlitedatabasesinacf.html
Screenshot of export:

The function can be copied into your ACF source file and renamed to your liking, so it gets a unique name in your solution. If you have more databases in your solution, you should give the generated function a different name for each database.
Here is a test example using the above export: The exported schema:

Functions to open or create the database, insert customers and contacts, and, at the bottom, a test function that inserts two customers and three contacts for each customer.

Example of InDesign Workflow implementation
To demonstrate an example of an InDesign workflow, we created a demo web app called “editorial”. It is included as an example in the InDesign plugin download, along with the ACF source for the integration.
The “editorial” web app is a website where editors can compose articles and upload images for their articles. Internally, it uses an SQLite database for storing articles, images, and other metadata. The web app contains a REST API that InDesign can query using the plugin and the ACF package.
Here is a screenshot of the web app and a test article:

And here is the images:

After installing the plugin, include either “editorial.dsComp” or “editorial.acf”. The .dsComp file is the compiled ACF package, produced using ACFcompiler, while .acf is the source code. If you install the source, the plugin will automatically compile it and produce the .dsComp file.
In InDesign, you will now have a new top menu called “editorial”, or a translated version of it if you have installed the language pack and uploaded the translation .mo or .po file.
For English:

For Norwegian translation:

Select “Connection settings”:

Here you set the service URL for the editorial website. In the admin section, you can generate an API key to include here.
When saved, open the “Article palette” and do a search:

It is a floating palette. You can minimize it using the upper-right corner down arrow, so it does not get in the way of the InDesign work, while still being available when needed. Here we have queried the editorial website and found two articles. I selected the “Traveling FileMaker Developer” article and can see the metadata at the bottom. I can override the body columns, gutter, placement options, or how images are handled. I leave it at the default settings and press “Place selected article”.

Now all the elements are placed, and the editor can adjust the layout, image sizes, and placement as desired. We could implement page templates to automate even further; this is all controlled in the ACF code.
The floating palette collapses automatically when placing.
Best Regards
Ole Kristian Ek Hornnes, System Developer.
