FileMaker to Google Translate for Longer Texts

ChatGPT is a better FileMaker Programmer Than Me

I am working on a database solution that imports the text of a full length book and translates it into other languages, any language supported by Google Translate. I had written a blog post called Making FileMaker interact with Google Translate with a demo file a while back and it mostly worked for small amounts of text, but I noticed that after 6,000 characters, the JSON file would come back with an error. Because I was working with an entire book, I need to upgrade my script to handle this limitation. I am still planning to break the book down into chapters, but I didn’t want to have to track how many characters I was sending.

I had written a script to do this and felt pretty satisfied after getting it to work. My script breaks the larger text chapter into chunks of a paragraph in length, avoiding the 6,000 character limit. It took me a few hours of trial and error to get it going. Then recently, I was watching a video of a Javascript programmer of 20 years say that he was using ChatGPT everyday and was increasingly convinced that it was a better programmer than he was. He was actually learning new ways of doing things from it.

ParseData Custom Function

So, I decided to ask ChatGPT to re-create the script that I had worked so hard on. In a few seconds, the way it does, it came back with a much simpler way of doing the task. My version had employed a Custom Function called ParseData and a counter to track which loop it was on and when to exit. ParseData looks for patterns in the text and extracts them — ParseData ( theText ; theStartTag ; theEndTag ; theOccurance ). I set mine up to look for text between two carriage returns.

My Script

To get my script to work, I had to make sure that there was a carriage return at the beginning of my text and at the end. I had to get a number of carriage returns in the text, to know how many times to repeat the loop. At the end of the loop, I incremented a counter and when the number of carriage returns in the text equaled the counter, the loop stopped. I was preserving the text in the variable by extracting a chunk of it paragraph by paragraph.

ChatGPT’s Script

ChatGPT suggested instead a simpler script that didn’t require a counter or a Custom Function. Instead it suggested repeatedly grabbing the first paragraph, processing it, then throwing the text away when done and stopping the script when the text variable was empty. Brilliant improvement!

Of course, the ChatGPT script wasn’t as detailed and I had to tweak it a bit for my purposes, but the idea was good and I have implemented it.


ChatGPT is not perfect. One time I asked it for a script and it came back with GREP commands embedded in a FileMaker script. As far as I know FileMaker can’t do GREP! Also, this script would not work ‘out of the box’, it needed modifications. For now, it is very useful for inspiration and speeding up work. A good programmer can benefit by it. New programmers may be confused by what returns, especially if it doesn’t work right away.

Let me know if you are interested in a demo file and I will clean up the one I am working on and post it.

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: