- Who: Beginner-Intermediate
- What: How to Test for and Automatically Install a FileMaker Plugin
- With: FileMaker 15 +
- Why: Instead of manually installing plugins for all your users, script it on opening!
It turns out it’s pretty easy to check for an installed plugin and automatically install it if it is not already installed!
Define a container field in a table that you can reference in your opening script. I like to create a table with one record that is related to other tables via a cross join. You can see in the picture to the left my field called “plugin_BaseElements” and the join with and “X” which signifies the cross-join (otherwise known as a cartesian relationship). Place the new container field on a layout.
- Insert the plugin required by your solution into the container field by right-clicking (Windows) the container field and choosing “Insert File”.
- Once the plugin in is inserted into the container field, you are ready to set up your “Opening” script.
In your “Opening” script, create a variable that uses the Get (InstalledFMPlugins) script step to find out which plugins are already installed. In the example to the right, I used the PatternCount function to check for the word “Elements”. If it exists, I give the variable a value of 1, if it does not exist, I gave it a value of 2.
- Next, use an If statement to test your variable for the value of 1 or 2. If your variable equals 2, use the Install Plug-In File script step to point to the container field containing your plugin! his will quickly and automatically install your script! I can’t believe how fast it is!
- Finally, test for success by creating that same variable and testing it again. This time the value you get should be a 1 and you know it’s successful. If you gt a 2 again, something went wrong and you can stop the script.
Hope that helps!