An Automator workflow for OS X which creats a system service that visually formats FileMaker Pro calculations for easy readability, in any app in the system, even outside of FileMaker.
The workflow is packaged here in a compressed zip file because once upon a time I had some problems with Github mangling something in one of MacOS's "package" folder-as-a-document structures, as Automator workflows such as this are. The .zip compression simply ensures the workflow is preserved as-is from my hard drive to yours.
After unzipping, you will want to open the workflow in Automator and look at it before you add it to your Services folder. Just look at it so you see for yourself that it's innocent and does what it says, and there's nothing tricky about it. This is just a good habit, for security. Don't go adding things to your system because a stranger on github said you can.
Place the unzipped _Format FM Calc.workflow
in your /Users/[yourname]/Services folder to add "_Format FM Calc" to your Services menu (usually available either with a mouse right-click or as a submenu of the Application menu in most apps after the Apple menu in your menu bar.) Or, in some versions of MacOS, simply double-clocking on the unzipped workflow file will bring up a dialog box offering to install it.
The original source code of the PERL script that does the formatting is visible as plain text once you open it within Automator too, if you want to see that.
One user has reported crashes and memory errors when using this system service in MacOS Sonoma with FileMaker 20. To my knowledge, nobody else has reported these issues, and I have not been able to reproduce them. An issue has been opened for this. Please be aware & prepared for this possibility when you use this, and back up any databases first in case of needing to do an improper shutdown. As with all Free & Open Source Software, use entirely at your own risk. In the event of trouble or issues, efforts at support are likely but not guaranteed.
This is substantially based on calculation_formatter.pl by Debi Fuchs [email protected] which was originally shared by Filemaker Inc in their Development Conventions PDF whitepaper in Nov. 2005, then heavily customized by me to make code clearer and keep up with changes in FM's calculation formatting beginning in 2012 forwards, as well as my own visual formatting. There are comments in the PERL code giving some info on my changes.
Michael E. Kupietz, software engineering, consulting, & support for FileMaker Pro, Full-Stack Web, Desktop OS, & TradingView platforms
https://kupietz.com (Business info)
https://github.com/kupietools (Free software)
https://michaelkupietz.com (Personal & creative showcase)