Making the Switch to Script Workspace (Without Losing Your Mind)

  • 2

Making the Switch to Script Workspace (Without Losing Your Mind)

Category : FileMaker 14 , Scripts

The new Script Workspace in FileMaker Pro 14 delivers on some long-asked for developer features, like color coding, more keyboard access, and a unified interface. But like any new feature, it’ll take some getting used to before you’re fluent with the new workflow. Here are some tips for keeping your sanity while you’re upping your scripting game.

Understanding the Script Workspace

The old Manage Scripts window showed a list of scripts and helped you manage them with buttons for creating new scripts and organizing tools like separators and folders. You’d open a new window to work on a specific script, and you could open as many of these Edit Script windows as you needed. Now all those tasks happen in the same window, called Script Workspace.

Script Workspace

Figure 1. The Script Workspace now has all the features and tools that used to be distributed over two different dialog boxes. Your main task will be to figure out where your favorite tools have gone.

 

All the features you’re used to are still available, you just access them differently. Figure 1 shows the new Script Workspace. The left hand pane shows a list of all your scripts. They’re arranged as you would have seen them in FileMaker 13, complete with their folders, separators and menu states. The three tools at the top of the Scripts pane let you manage the list. From left to right, these tools:

  • toggle the checkboxes you use to put a script in the Scripts menu
  • create a folder
  • create a separator

If you click a script, it’ll open in the middle pane. When you have multiple scripts open, they’re arranged in tabs across the top of the pane. You’ll learn some tips for editing scripts later in this article.

Script steps are shown in the right pane. For new users, the handiest feature is the Description box at the bottom, which gives you info about the selected script. You can filter the list of steps with the search field at the top of the list. Tools at the top of the Steps pane let you mark your favorite steps, so that they appear in a special section at the top, and organize the list alphabetically or grouped by function.

The buttons at the upper left of the Script Workspace lets you create new scripts, run the selected script, and start the Debugger (if you have FileMaker Pro Advanced). Buttons in the upper right show script steps’ compatiblity, toggle the Scripts pane, and toggle the Steps pane.

If some of your favorite features seem to be missing, take a look at the menus.

Many of these commands are available through other means in the Script Workspace, like New Script, New Folder, and others. But Grant Full Access Privileges (formerly a checkbox at the bottom of the old Edit Script dialog box) is only available from the Scripts menu.

Don’t forget the View menu, which also changes context when the Script Workspace is active. Again, most of the commands are available directly in the workspace. But the bottom command, called Syntax Coloring, is where you can customize the color coding that makes it easier to read your scripts at a glance.

Syntax Coloring

By default, script steps are now numbered and color coded. To understand what the colors mean, take a look at the Syntac Coloring dialog box shown below.

Syntax Coloring

Figure 3. The Syntax Coloring dialog box (shown in a Script Workspace with the Script and Steps panes closed) lets you customize the default colors that appear in the Edit Scripts pane.

Script Flow refers to the script steps found under the Control section of the Steps pane. (Well, most of them: Set Variable, Set Layout Object, and Install OnTimer Script don’t get colored.) They’re the steps you use to perform logical tests, branching, looping, calling subscripts, and other meta functions. By default, those steps are shown in blue.

Disabled and Incompatible script steps are shown in light grey by default. Green steps are comments (text notes that don’t perform any action). Note that the blank spaces in the script shown here are just comment steps with no text. One really nice improvement is that blank comments no longer show the # sign at the left. It’s cleaner — now your scripts’ white space really is a resting point that makes your script easier to read — plus it’s more like other scripting environments. Finally references to schema are shown in purple.

You’re free to change the custom colors any way you want, but the default colors are mostly pretty good. They stand out well from the main code and aren’t too similar to one another. The only exception to that is that Disabled and Incompatible steps are both a light grey color. It’s true that neither item will run when the script is executed, but you may prefer to see a little more warning for incompatible steps, like the orange color shown in Figure 3.

Using the Keyboard

Once you get past the rearranged furniture in the new Script Workspace, you could use it almost the same way as the old, two-dialog box model. That is, if you’re just getting started learning to script, you may depend on the step list to remind you what commands are available for scripting. And once you find what you need, you can point and click to add steps and set their options.

But the real power of the new setup is the keyboard shortcuts you can use instead of your mouse. You can’t throw away your mouse completely, but the new Workspace gets us a long way toward the nirvana of typing code manually. Here’s a list of handy keyboard shortcuts for writing scripts without the mouse:

  • Enter or Return key. If no steps are selected, the Enter or Return key adds a new line at the bottom of your script. If a step is selected, the new line appears below the highlighted step. Shift + Enter/Return adds the new line above the highlighted step.
  • Use the Up and Down arrow keys to move the highlight through the script.
  • Hold the Shift key with the Up/Down arrows to select multiple, contiguous lines.
  • Move selected script steps with Command + Ctrl + Up (or Down) arrow keys.
  • The curly braces let you move through the open script tabs in the Edit Script pane. Command + { moves to the next tab, and Command + } moves to the previous tab on the Mac. Use the Ctrl keys instead on Windows.
  • Close a Script tab with Command + W (Mac) or Ctrl + W (Windows).
  • To add a step to your script, create a new line and then start typing the step’s name.

Did you get the importance of that last item? You can add steps to a script just by typing! This is probably the most important upgrade in FileMaker Pro 14 because of the time it will save developers by typing instead of reaching for a mouse. Here’s how it works: once you start typing in a new line, a popover list appears showing all the steps that match your text. So if you want to add a Set Field step, create a new line and then type “set f.” A list appears below the new line, and it’s filtered by what you type.

Once the step you need appears on the list, use the arrow keys to highlight it, and then hit the Enter key to add it to your script. Then hit Enter again to show the step’s options. Use the Spacebar to option an option’s dialog box. When a step has more than one option (for example, the Set Field step has a Specify target field option and a Calculated result option), use the Up/Down arrow keys to move between options. When you’re done setting all a step’s options, you can de-select it with the Escape key, or by creating a new line.

But maybe you think the typing “set f” is too much work. Then you can type the first letters of the name of the step you need. In other words, type “sf” and the list is filtered to show all steps that have any words that begin with both an “s” and an “f” and in that order (Constrain Found Set has words that start with “s” and “f,” but it won’t appear in the list because “Found” comes before “Set” in this step). This rule is harder to explain than to understand. But for those steps you use often, like Go To Related Record or an If test, you’ll soon be typing away without thinking about it.

It’ll take some practice to get all these tricks to become second nature. But most experienced developers report that they’re already writing scripts much more quickly than they used to, and that they’re not nearly as efficient when they have to work in FileMaker Pro 13.

Disabling script steps

The Workspace giveth and the Workspace taketh away. Several of standby favorite commands aren’t nearly as accessible as they used to be. For instance, you can still disable script steps, but it’s gonna take you a while to find the command. Select the step(s) you want to disable, and then choose Edit > Disable. Reverse the process to enable a step.

Fortunately, there’s a keyboard shortcut you can use instead. On the Mac, Command + / (forward slash) toggles your highlighted steps. Use Control + / on Windows.

Note: If you can’t find this command, you may be working with FileMaker Pro. Disabling script steps is one of the developer tools in FileMaker Pro Advanced.

 


About Author

sprosser

Susan Prosser is a FileMaker Pro developer and author. She's stopped trying to bring more information to the people and is helping them get the most out of the information they already have.

2 Comments

FileMaker Pro 14's Best New Features for Developers – dbhq.net

May 12, 2015 at 7:34 am

[…] Here are our tips for learning to use the new Script Workspace without losing your mind. […]

FileMaker 14 Platform learning resources…a list in progress… | New York FileMaker Pro Developers' Group

May 23, 2015 at 2:33 pm

[…] Making the Switch to Script Workspace (Without Losing Your Mind) – dbhq.net http://dbhq.net/script-workspace/ […]