Home
Username:
Password:
FileMaker Pro 9: Advanced Tutorials

Custom Form Letters / Text Attribute Script pt. 2




Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.


Learn More

Subtitles of the Movie

So we'll go back into ScriptMaker and we'll take a look at that script and again, we have this formula inside here. That's the formula we just looked at right there. But on the outside we have Text, Format, Remove. Why? Well, it's best explained by showing you. Why are we removing all the formatting each time we grab the text? Well, the problem comes is when you add some formatting, let's say, bold and underline, to it and then you come and you go, okay, I want to remove bold and underline but have italic. If we don't do that Text, Format, Remove, it's just going to add in italics and not remove bold and underline. So we have to remove it each time just because of basically the interface we have and how these functions work. We'll take a look at it real quickly and we'll come in here and look at Text Format Functions. You'll see most of them have Textile Add and Textile Remove. It's not: Change it to this Textile, it is Add or Remove it. So if you add onto it keeps the existing one. So that's why we have to do this. And then, we set another variable, a local variable, dollar sign selection, to the Selection Start and the Selection Size, and we separate it with a space. Now I could have done two variables here, but I thought, well, they're just numbers so I can do leftwards and rightwards to parse some out of this one variable. So it was easy enough to do and I just didn't have to do as many declarations. It's really not that big of a deal but I decided to kind of show you an idea of how you can pass two values in one variable. And now then what I'm doing is I'm clearly that field. I'm clearing out whatever's selected, and we're doing that so that we can then go ahead and remove any type of residual formatting. And that's the best way I can describe it. It's easier to show you. And actually, the Clear goes along with this Set Selection. We're actually saying, Set the Selection to where that cursor would be. We don't care about highlighting because we just cleared. We just want to put the cursor right in the same spot. In fact, once we clear it this actually puts the cursor right in the exact same spot. Why do we do that? Well it's best explained by this. If you come in here and look at this I double click on this, go in and say, I'll change that to bold, right? Then I clear it, and then I start typing again, such as what I'm going to do with the script, the bold is still there. No matter what I do, that residual's formatting is there. Only when I move the I-beam out of there and back to the same place is it gone. So I just experimented with it and figured out how can I make it so that I get that residual formatting out of there. Well, clear, and then set the I-beam right back to where it was. Then we can actually insert our Calculated Result. This is the real of the magic of this. What we're saying is: Pass in dollar sign text, that's whatever we have selected, like let's say the word: FileMaker and let's apply text color to it. And what we're doing if we look at text formatting functions here, text color, it uses the RGB function, so inside the RGB function we provide, through the relationship, because remember we popped up X color, it looks over to the colors table and pulls out the right RGB values for us. And so we apply that text to that variable and that's saved inside of this Add Color. Add Color is then passed into here, and we apply Text Size to it. This is very simple. We say, take whatever you've done to Add Color and apply size to it. Now Text Size is very simple. Just give us the font size. So we just pass it along this field: very, very simple. Now Add Style's a whole different story. This is the most complicated. But the first thing you want to notice is that we pass in Add Size into it, and that's passed into the Textile Add into the text we want to work on. But on the style, we have this funky formula here, and really we want to start looking at this part, the substitute. And if you remember correctly, when you check items in a checkbox they're stored in a Return Separated List. So let's take a look at why we're saying: Take that Return Separated List and change the returns into plus signs. Well if we look at Help, it'll make sense. Here's the Textile Add function, and you can see down here that when you try apply several types of styles you have to put a plus sign between them, so that's why we had to do that. So if we come back here we'll see that that will change it into the format that it wants, but unless we put the Value Weight Function around it, it will not work. Those plus signs will not be seen as what they're supposed to be seen as. You have to throw the Evaluate Function around and it changed it so that it will actually understand that, and then we apply all those settings we have: bold, italic, underline; whatever we checked, will all be with plus signs in here and added to that. And then the result of the formula is simply Add Style. Once we're done, we want to go ahead and reselect that text because when we insert, our cursor's going to be at the end of the word FileMaker. So we need to reselect the text. You've seen this one already. That sets the starting position, but you'll notice that we have ending position here. But what we've saved is Selection Size so in order to get End Position we have to take the right words, which is the Size and add it to the Starting Point and then subtract one, and that gets us the End Position. Okay, so the functions up here don't really work well with it. This Get Active Selection Size and Start. They don't really work with the Set Selection that well, because they're asking for different things. This one's once, start, and end, and we've said, you know, you're start and your size. So we had to work with it, but it's not that complex. So that's all you have to do. We'll save this, come back in here, make sure it works, apply that, and you can see that it works. And if I come in here and decide to remove italics, you'll see that that italics is removed.

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
  • 98,729 Video Tutorials (23,265 free)
  • Video Available as Flash or QuickTime
  • Over 1026 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available