Tutorial 202:


Tutorial 202: Lesson 3

Scripting strategies

Lesson Materials
Download Files

Taking your app to the next level

Now that your interface changes are in place, you’re ready to start automating more of your app. If there’s a task your users perform in your custom app which can be written down in a series of steps — even if those steps include decision points — it’s likely you can script that task to automate it.  

Building on what you learned about scripting basics in the Create tutorial, in this lesson you’ll write a script from scratch, and learn how to make your script more user-friendly. You’ll write scripts that let the user make a decision. That’s when things get exciting — when your scripts can start to think!

Along the way, you’ll learn techniques to become a more efficient script-writer: you’ll try the Script Workspace’s typeahead feature, which speeds up your script creation. You’ll learn how to use the same script in two different places, by passing the script a parameter — extra information you send to the script when you call it. For example, you can tell a search script what to search on, and use the same base script in many different buttons, with different search criteria in the parameters. You’ll also practice using variables to temporarily store information you need within your scripts.

Why is this important?

  • Scripts are among the most powerful tools in FileMaker Pro. When you increase your scripting skills, you can take increasingly complex sequences of work off your users and perform them automatically.
  • Navigating, creating, and deleting records are all available to a user within the FileMaker status toolbar, but you may not want to train every user in how to manipulate these tools. Make it easier on everyone by scripting common routines so they can be achieved effortlessly.

Video 1

Writing a script from scratch

Practice a “Plan, Write, Test, Run” process to create a script allowing users to easily create a new Visit for a Client. You’ll learn how to hold information in a variable, for use in your script.

In this video, you will:

  • Plan your script: have a clear goal in mind (1:49)
  • Create a button: begin a new script right from the button object (2:31)
  • Write your script: try the Script Workspace typeahead feature (2:38)
  • Use a variable: store data from the beginning of your script in a variable, so you can use it later in your script (3:48)
  • Test with Debugger tools: use the Script Debugger and Data Viewer to make sure you got it in FileMaker Pro Advanced (8:57)

Video 2

Scripting a delete with a custom dialog

Use a Custom Dialog in a script that deletes a related record, so dialogs from the app can talk to your users in their own language.

In this video, you will:

  • Plan your script changes: think through the goal and steps involved (0:53)
  • Create a Delete script: write a new script to delete a related record (3:29)
  • Refine the script: add a Custom Dialog so the delete’s confirmation dialog interacts with the user more naturally (4:58)
  • Add branching logic: check an input, then take one of two paths (6:22)
  • Test as a user: confirm that everything works (8:40)

Video 3

Creating a dynamic script with script parameters

Instead of duplicating a script, use script parameters to make a script dynamic — or able to change — so the same script can be called from two different layouts.

In this video, you will:

  • Plan your script changes: think through the steps involved (0:35)
  • Pass the script a parameter: call the script from two different layouts, and tell the script where you’re calling it from (2:29)
  • Make note of the parameter: adjust the script to incorporate information passed in the parameter (2:58)
  • Test as a user: test all branches to confirm that everything works (5:11)

Related Resource