Using AppleScript to Automate Business Workflows
I was surprised recently to see an announcement about an updated version of the ebook FileMaker Pro Scripting Book with AppleScript (English Edition) and also pleased that others are still using the combination of FileMaker Pro and AppleScript to automated tasks using software that has been around for several decades.
AppleScript is the scripting language created by Apple that lets you directly control Mac apps using instructions written in an English-like scripting language. It was first introduced in 1993 when System 7 was the current macOS operating system. In 1995 Claris (still in its first incarnation under the Claris brand name) released FileMaker Pro v3 which included the Perform AppleScript script step which allowed you to call AppleScript commands from a running FileMaker script.
I’ve drifted in and out of AppleScript development over the years but recently turned to it as a way of automating some repetitive tasks as part of the process of releasing updates to our suite of FileMaker integration solutions. Every time we release an update to a product we have to perform a number of steps which include:
- making a copy of the master development files
- opening the new copy and performing a FileMaker script to clear out any test data
- setting the File Options to use a default login
- create a .zip file of the new version
- upload the .zip to our online store via FTP
We also release an updated trial version at the same time which includes the above steps but also some additional steps that involve the FileMaker Pro Developer Utilities to remove admin access to the files.
We were performing each of these tasks manually and sometimes we would get distracted and forget to perform a step or perform the steps in the wrong order and then have to start all over again. The process was very much prone to human error. I wrote last year about how you should Automate What You Hate and this was definitely something I avoided and did not enjoy. After thinking about how I could automate all or parts of this process I knew AppleScript would be the most likely candidate.
For a few months in my spare time I had been developing a FileMaker solution to manage these tasks and automate them but hit a brick wall when I realised that my FileMaker Script, which was using the Perform AppleScript script step, couldn’t call FileMaker scripts as part of the AppleScript whilst the FileMaker script was running. It would generate this error:
"FileMaker Pro 19 got an error: No user interaction allowed." number -1713
After several failed attempts to work around this I abandoned the FileMaker solution and resorted to using AppleScript directly and just running the script manually using the Script Editor application which has worked a treat. I use Panic’s Transmit for handing the FTP upload and that has great support for AppleScript. My AppleScript skills were a bit rusty but thanks to Google and a bit of trial and error I was able to get a working script in a matter of hours.
The process now involves a simple double click to run the script and within seconds the AppleScript performs a series of commands using the macOS Finder, FileMaker Pro and Transmit that is free of any human errors. It now makes releasing updates to our products an enjoyable experience and something we are now likely to do more frequently rather than putting this off.
If you’re using Macs in your business and finding yourself manually performing a series of tasks multiple times it is worth investigating whether this can be scripted using AppleScript. It might not be as exiting as modern API integrations but this venerable piece of technology can still help businesses automate repetitive manual tasks that are prone to human error as we have been recently reminded.
Andrew,
Thank you for this article! Like many others, I’m guessing, the fact that AppleScript has been out of the spotlight so long that I’ve almost completely forgotten about it.
Thank you for reminding us of a tool that still has some incredible usefulness and has a much more gradual learning curve. This certainly fits into the “Automate what you hate” category.
All the best,
Jim
Hi Andrew,
Applescript has been an essential part of our Job Bag invoicing system since 2000. The script essentially exports job details from our FileMaker database and imports the data as a Service Invoice into MYOB AccountEdge. The script hasn’t needed to change in all that time which unfortunately means I don’t get to use AppleScript very often and improve my skills with it. LOL! I hope it continues to be an option for solving issues with FIleMaker
Ian