Home
Username:
Password:
FileMaker Pro 9: Advanced Tutorials

Ultimate Find / Modular Scripting

Subtitles of the Movie

It's very important to idiot proof your solutions against accidental mistakes or malicious hacking. For example, if we hit our Find script and then show the Status area you can see that we have a Cancel option here. And we can access that through a keyboard command. On the Macintosh it's Apple or Command period, and on Windows it's the Escape key. Now, on Windows you can't cancel a paused script, but it's still an issue. What if you have a script that's going around all over the place from layout to layout and somebody cancels it in the middle of it, just by hitting the Escape key, and all of a sudden they're on some layout you don't want to be on. That could be an accident, and they'll be in trouble, or it could be malicious and they'll have access to some area that you didn't want them to have access to. So what we want to do is prevent this from happening. We've actually already gone over it. It's very easy to do, but what we haven't gone over is how to modularize it, and the benefits of that. So, we're going to go into ScriptMaker, and we're going to go to our Ultimate Find script, and what we want to add is, Allow User Abort, Off. And that should come at the very beginning of the script and that says, You can't cancel the script. It lasts for the entire script unless you turn it back on, but as soon as the script is done running, the next script you run, if it doesn't have Allow User Abort Off on it, it's going to be on. The default is on. So it only lasts for one script step. But I'm not going to add it like this as I did before. I'm going to save this. I'm going to create a new script called Allow User Abort. And we're going to add in our Allow User Abort script. And so, what is this doing for us? Well, we can come back in here, we can add it to any script we want using Perform script, and we can just simply choose it, and now this script has Allow User Abort Off, or whatever I said over here. If I come back into Allow User Abort and change it to On, well, then any script that calls it, is now on or off. So I can come into any one of these scripts and add Perform Script, Allow User Abort. So the benefit of this is that you can make your script modular. In other words, you can reuse your code. And this is really the simplest way to do it. So, let's say you had 200 scripts and you're working on your solution and you want to be able to cancel script in case something happens. Well, you want it on. Let's say all of a sudden you ship it, or you give it to your users and you want it to be off. Well, you have to go to 200 scripts and turn it off, and then you might work on it and need it on. See how easy it is to turn it on and off for all the scripts that call this? So, really what you should do is go through all these scripts and add the Perform Script, Allow User Abort on there. So let's try it out and see how it works. Come over to Customer's form, hit Find, and now you can see I'm hitting Command period, and it doesn't work. In fact, if you show this, there's no Cancel button left. But we also should get rid of this Status area, so we can easily do that. I'll hit cancel here, go into ScriptMaker and we should really do that all the time, not just on the fine script. Any time that we are inside the database and we're not the administrator, the developer, the Status area should be hidden and locked. And, we did that before but I really think we need to take a step further and lock it as well, and so we don't really need to do it inside of our Find script and every script that we need it in. This script step, once you set it, stays for the entire session, in other words, until you close the file. It's not like Allow User Abort will last for one step, or one script. So we can come into our open script and we can change this to lock and then move that inside of this sys statement because this already tests. If it's full access, do this install menu set, otherwise do this, and then we'll say, Hey, let's also lock and hide this. And you don't need to put this up here, but I'll do it anyhow. I'll hide it but not lock it so in case I want to get in there. And so this will do this for us. This will be perfect. In fact, I like this technique so much with Get Privilege Set Name equals Full Access; I'm going to copy that. So we're going to get Else and the And If and we'll copy that with the keyboard command, close this, save it, come into our Allow User Abort, and we'll paste into there. Make sure you click down in here first; paste. So. We'll duplicate and we'll turn it to on. So if I log on the developer it's on, otherwise for everybody else it's off, and that way I don't have to remember to turn it on and off and on and off. It's in the state I want it, whether when I log on or when someone else logs on it's not in that state. So we'll close that, and let's go ahead and test out this locking of the Status area. So, we'll close the file. We'll double-click on it, we'll enter User1, 1234, and you can see it's locked so you can't get in. It's dimmed out. And if we log back on with the ADMIN, 1234, then you can see that this is available if we want it. So that's a great little feature. Make it automatic using that Get Privilege Set Name, lock that area so people can't get in there because we have a perfectly fine interface that lets them do everything they need. They don't need to get into these areas.

Tutorial Information

Course: FileMaker Pro 9: Advanced
Author: John Mark Osborne
SKU: 33824
ISBN: 1-934743-32-1
Release Date: 2007-11-21
Duration: 10 hrs / 115 lessons
Work Files: Yes
Captions: For Online University members only
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