As a FileMaker developer you probably spend a big chunk of your time writing scripts. The new Script Workspace in FileMaker 14 is going to help you in a big way. It’s a breath of fresh air and at first glance it might seem trivial in that we now have colors and we actually can have white space, but there are many other productivity improvements that lurk beneath the surface.
Just so we don’t forget where we came from, here is what we have had until now:
And compare the same script in the new Script Workspace:
Not all lines are created equally. Prior to Script Workspace every single line in your list of script steps was a step. Now, if your window isn’t wide enough to show the complete information for a step, it will wrap it. As in the example above you’ll see that the Show Custom Dialog step wraps onto the next line. Like many things about the new Script Workspace, things take a little getting used to. Selecting the second line in the Show Custom Dialog step will select that whole step, so nothing to worry about there, as you’ll be able to copy and paste that single line as you have done in the past. It just might take a little getting used to when debugging or reading your script.
One of the first things I am tempted to do is to give my scripts a fresh coat of paint: more spacing, more comments, etc. I hope in the future we’ll see steps like Loop and If statements be collapsable and much more. But for now it feels great to be able to get in there and improve the readability of our scripts.
As soon as you select a step and hit Return, you’ll be able to create more white space. If you want to type a comment, then, on an empty line, just start typing a “#” sign and the text for your comments. However, Return isn’t always going to give you a new line. If you have a step selected and you tab, you’ll now have a focus area. In the example below you’ll see the “Allow User Abort” option has a light blue border around it. If you type Return, you’ll toggle from Off, to On continually as you hit Return.
So the Return key can function as a number of things. It gets even more interesting: if you select the If step and tab over, you’ll be able to edit the calculation. You don’t need to dive into the new calculation window with this action; rather you can edit the calculation right in place.
CAUTION: Be careful if you accidentally start typing while the whole thing is selected, or you’ll lose your calculation. Undo doesn’t work here; you must revert your script to get that calculation back. Not a big deal if that is the first thing you have started to change, but a bigger deal if you have many, many other changes leading up to this one.
Are you confused yet? Like I said, it takes a little getting used to.
Let’s step back and take a look at the left and right sides of your Script Workspace. The left side shows you all of your scripts, and if you start typing you’ll be able to find the script you are looking for. If you start a brand new file the only thing you’ll see is the plus button to create your first script. The 3 icons on the top of the list of scripts allow you to do the following:
1 – Show which scripts are displayed in the menu. It toggles to show a checkbox so you can check or uncheck which scripts you want to display in your scripts menu.
2 – Add a script folder.
3 – Add a separator.
The three buttons on the far right of the Script Workspace are for compatibility, and to show or hide the panels on the right and left. Because I can now type my steps, I am inclined to close that right panel and just rely on typing my scripts.
Assuming you have the right panel open, you can sort steps alphabetically or by favorites, but I’ll probably never end up using these buttons. If I can start typing “If” and complete my step right there, why would I break my flow by reaching for the mouse to click on a shortcut script step?. There is some additional description at the bottom of the steps list for the selected script.
OK, so we’ll get used to selecting a script from the left pane and editing them. But there are some subtle things there to note. If you simply select a script and then another script, you’ll be switching from one script to another. If, on the other hand, you double click on a script…don’t worry, you haven’t edited it, but it will show up in its own tab. So, when you end up with many scripts in your tabs and want to have that script selected in your scripts pane, you can do this by right-clicking on the script name in the tab and choose “Select in Scripts Pane”. As a matter of fact, by right-clicking on the script tab you’ll also have the ability to rename the script or move into its own window.
Let’s talk about color for a bit. You have 5 colors as shown below. The script flow pertains to loops ( Loop, Exit Loop If, and End Loop ) and conditionals ( If, Else, Else If, End If ). The other colors are self evident. Colors only extend to steps and not the actual calculation parts, so don’t expect to see field references in your calculations colored as the color you have chosen for Table::Field.
By the way, if you are looking on how to disable a script step, you’ll find it under the Edit menu (or, when you have a step selected, Command+/).
The other thing that I went looking for was the Run with Full Access checkbox. It’s now located in the Scripts menu, renamed to “Grant Full Access Privileges”.
When a script has been granted Full Access Privileges, a person icon shows up to the right of the script name in the list of scripts.
There are many of them. Let’s say I want to quickly navigate to the top or bottom of my script. Option+Up Arrow (Mac), Alt+Up Arrow (Win) or Option+Down Arrow (Mac), Alt+Down Arrow (Win) will get you there instantly.
Mac: Control+Option+Up/Down Arrow … will move a set of selected scripts up or down.
Win: Control+Alt+Up/Down Arrow … will move a set of selected scripts up or down.
And of course, Copy and Paste work as you would expect them to work. However, I wish I were able to also copy the contents of a script to my OS clipboard as text and paste it into an email to share with a friend, rather than copying it only to some private clipboard for internal use.
Maybe it’s not noticeable or evident from the start, but I think as more people start writing more scripts rather than clicking to add steps to their scripts, we’ll see the FileMaker developer community improve in terms of learning, and as a result script quality will improve. I know mine already has after just a short time with the new Script Workspace.
All told, I find the new Script Workspace a very welcome addition. It does taking some getting used to, and I continue to stumble with regards to Tab and Return, but those things will get ironed out eventually.