Username:
Password:
FileMaker Pro 10: Advanced Tutorials

Ultimate Find / Modular Scripting pt. 1

Subtitles of the Movie

It's very important to idiot-proof your solution against accidental mistakes or even malicious hacking. For example, if we run our Find script, you notice we have a Cancel option here. We don't want somebody to click that and be stuck in this Find layout. In fact, you can access these Cancels, when your script is running, through keyboard commands. On the Macintosh, it's Command or Apple period, and on Windows, it's just the Escape key. Now, there's a little difference on how it works versus Macintosh and Windows. On the Macintosh, you can actually cancel Pause Script. On Windows, you can't, but still, you don't want to allow people to Cancel Script because let's say you're writing a script that goes from layout to layout and does all this stuff. If somebody can hit the Escape key while it's actually running and cancel it, then they'll be stuck on some layout where you don't want them to get access to. So it's always a good idea to idiot-proof your solution, lock it down so people can't accidentally get stuck somewhere where they shouldn't be, or even maliciously attack your system and get to somewhere where you don't want them to have access and learn something about your solution and maybe even hack it. Who knows what? So what we want to do is prevent this Cancel button from being clicked or even showing up, so we're going to click Cancel here. That one's okay. We designed that Cancel button, but we don't want that Cancel because if we run it, watch what happens. We hit Cancel, we're stuck here. We're in Browse Mode, but it looks like Find mode. I mean, so many things could happen here, so we're going to go into ScriptMaker and we're going to look at our Ultimate Find script and we're going to add Allow User Abort. We'll move that in there, put it up at the very top. Now, we've already covered this. This prevents your script from being canceled. If it's off, then you cannot cancel this script. The only bad thing about it is once the script is done running, it goes back to the default and turns back on, so in other words, let's not save this, you'd have to go to every single one of these scripts and add Allow User Abort Off. We've done that to some of them, but let's say that you're the developer and want to work with the solution and you may be designing some kind of script that could possibly get stuck in a loop or something and you need a Cancel. Well, you have to go to each one of the scripts, or at least that one, and turn it off and then turn it back on. What if you forget? Or if you want to have the ability to cancel any script, well, you have to turn them all off and all on all the time, depending on whether you're using it or the user is using it. So it can be a lot of work for such a handy little feature, but there's an easy way to get around this and make it easier for you to use it. The way is to do modular scripting. So we'll make a new script and call it Allow User Abort, and we're going to simply add Allow User Abort. We'll put it to off, close this, save it. There's our Allow User Abort. I'll put it down at the bottom so we can find it easily, go into Ultimate Find, put in Perform Script, and change that to Allow User Abort. So now, when this script calls the Allow User Abort, it will turn it off and, even though it's in a different script, Subscripts that allow the user to abort will go all the way through the calling script, so that's great. This works perfect for us. We won't have to set Allow User Abort on every single script. It has to call a script, a Subscript, and that will flow through this whole calling script and have Allow User Abort off until this is done running. So what we can do is go to every single one of our scripts. Let's go to Find Marked and we'd add Perform Script, Allow User Abort. Now we can turn them on and off, so if I come in here and come to Allow User Abort and turn it to on, well, then any script that calls a script, it will flow through and turn it on, and then I can turn it off whenever I want. I don't have to go to 200 scripts and turn them on and then off. It makes life a lot easier, but we can make this even easier than it is right now.

Tutorial Information

Course: FileMaker Pro 10: Advanced
Author: John Mark Osborne
SKU: 33927
ISBN: 1-935320-20-3
Release Date: 2009-01-05
Duration: 12 hrs / 150 lessons
Work Files: Yes
Captions: Available on CD and Online University
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 81,350 Video Tutorials (20,800 free)
  • Video Available as Flash or QuickTime
  • Over 782 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available