Create a Simple Progress Bar in Filemaker that will check the progress of an AppleScript.
The original idea for this progress bar was posted here. It shows how to create a progress bar using the Let function in Filemaker. In their example the bar indicated the number of records processed.
Using AppleScript with Filemaker.
Filemaker is fully scriptable with Applescript. This combination can be very powerful and I process all my clients and image data through Filemaker and Applecript. Filemaker has no built in progress bar which can be very troublesome when processing a lot of data. I wanted to use a progress bar to indicate the progress of an AppleScript which processed image files for one record.
Please download the example file to reference the next instructions.
Filemaker 9-11. Works with later versions when updated.
If prompted for username use Admin. No password required.
Please note that this will only work with OSX and will not function with Filemaker Go.
Building the progress bar.
Create a text field “progressBar” with these options
In the Inspector make sure the Show repetitions is horizontal
Create two more global text fields “endcount” and “repeatcount”
From Filemaker 9 you can conditionally format fields.
In Layout Mode:
Right click progressBar and open Conditional Formatting
Use any fill colour you like
Specify the Formula as this
Let ( [ thecurrentStep = progress_Bar::repeatcount ; theTotalNumberOfSteps = progress_Bar::endcount ; theCompletion = Truncate ( (thecurrentStep/theTotalNumberOfSteps) * 100 ; 0) ] ; theCompletion ≥ Get ( CalculationRepetitionNumber ) )
With this interpretation of the original post thecurrentStep uses the number in the repeatcount field and theTotalNumberOfSteps is determined by the endpoint field.
In the database – Example 1 change the value of the endpoint field and press Process Files to see the progress bar in action.
The repeatcount field is initially set to 0 and then incrementally increased through the loop until it reached the endpoint number
In Example 2 an AppleScript is called which lists and counts the names of all the files in your desktop folder and sets the endcount field to the count of files.
tell application "System Events" set theNames to the name of every file in desktop folder set num to count of theNames end tell set cell "endcount" to num
In the script loop sequence an Applescript gets a list of the file names from the desktop and the specific item in that list is called using the number from the repeatcount field. A new text field created called “processing” displays the name of the file being processed.
tell application "System Events" set theNames to the name of every file in desktop folder end tell set num to cell "repeatcount" set itemtoProcess to item num of theNames set cell "processing" to itemtoProcess To download the file https://www.dropbox.com/s/9bmp4ll83nk9sae/progressbar%20example.fmp12?dl=0 Use Admin and no password