We're finally ready to add the script that will apply our text attributes to the currently-selected text. I've already programmed the script because it's very complicated so we'll just review it. You'll see I have the button right here and it takes all of these attributes, whatever you have specified and applies it to the selected text down here. So let's go into our Manage Scripts, come down and find our Letter, it's called Letter Attributes and we'll edit it. And we do our Allow User Abort and then the first important step is Set Variable dollar sign Selection Start to get Active Selection Start. So this is important because we're going to be deselecting the text later on so we need to remember what was selected so we can reselect it at the end. It's way down here at the bottom. We do the same thing with Selection Size. We say Set dollar sign Selection Size to get Active Selection Size. So these are two for remembering things. Then we come in here and we Set a Variable dollar sign Text to this formula. We set it to Middle and we're just going to look at this middle part here. We're going to look at the middle function, forget about text format removed. We're going to say get the Active Field contents, which is whatever we highlighted. Might be FileMaker or who knows what text we have highlighted and then say starting from the point, the dollar sign Selection Start, get this amount of text dollar sign Selection Size. So essentially what it does is it grabs out of there whatever we have highlighted. Let's demonstrate that. Let's show you what it does here. So we'll close out of here. What we're going to do is pull up the Data Viewer and we have a very similar formula in here. Let's take a look at it. It's similar in the fact that it uses exact same formula but it doesn't use the variables. The reason we use the variables in the script is because we use Active Selection Start many times throughout the script and then we might as well declare it once. Here we can't use the variable here so we just use the actual code here. So we're saying in the currently active field contents, look inside, probably most likely be xletter, get the Active Selection Start and the Active Selection Size and give those parameters or those values to the parameters in the middle function. So let's see how it works. If we go and select FileMaker and then refresh the values, we can see it puts FileMaker in there. If I select this text right here and refresh the values, it puts that in there. In fact, I can be in any field I want. It's completely dynamic. I will grab any selected text. So that's how that formula works there. We'll come back in here and look at our script and so we do all that and then what we do is remove all the formatting here. We use the Text Format Remove. This removes every single piece of formatting. The reason for that is what if we already have some formatting applied to it? So let's hit Cancel again here, come back out. What if we select FileMaker and want to apply something without bolding on it? Well, what's going to happen is if we apply it, it's going to keep the bolding and add underline. What we want is to remove the bolding since it's not selected. That comes in when you take a look at, we'll go back to the script here. If you look at the way that those text formatting functions work, that's how they function and so we'll go into any formula here and look at text formatting functions, you'll Text Style Add because you add on the styling in there. So we make sure we take care of that with the Text Format Remove. Then we go ahead and clear the contents of whatever's highlighted. There's a very important reason for that. And I'll show you why that is. We're going to go ahead and highlight FileMaker and then delete it and then start typing. Notice that we have the HHH there. It's going to be there no matter what unless I clear it, move my cursor, even it's back to the same spot and all of a sudden all that formatting is gone. So that's why we do that. We want to make sure that we get rid of all the formatting that doesn't keep in there. And that's just the way any word processor or even FileMaker works. It's just how the, that engine works. You have to move out of that place for that formatting to really be gone. So we'll come in here. So that's the idea behind this. We clear and then we set the selection back to where it was. It's putting it back in the same spot but that clears out that residual text formatting in there. Then we come onto the magic part of the script. This is the Insert Calculated Result with no selection, no target field so it can do it anywhere. It's completely dynamic and here's our formula. We declare a bunch of variables here. First one's Add Color. We say Text Color, that's one of your Text Formatting Functions, which needs the test you want to change and the RGB values. So we say dollar sign Text. Remember, this is the text that was highlighted like FileMaker and then we say apply those colors through that relationship. So whatever color we have, it pulls in the right RGB colors. This allows us to make it very dynamic and why we made this table. If we just used a case statement here, which we could have done and not made a table, we'll then we would have had to come to the script every time we wanted to update the colors or add a new color or something like that. So that's very important to make it very dynamic. Then we take and declare Add Size and it uses Add Color. So Add Color works and then passes its result on to Add Size and it says add the size on there. And it doesn't really add it. I shouldn't say that. It actually changes the size because you can only have one size on text. That one's very easy. But Add Style is a little bit more complicated. It's Text Style Add and we have to use this more complicated formula here. So what we do is we can apply multiple styles at once and if you take a look at your Help and we'll move this over to the side here and scroll down in the Text Style Add Section, you'll see all these styles you can add but if you go down farther, you'll see that if you put a plus sign between styles, you can add more than one style at once. And that's the idea here. We want to be able to add more than one so why do we need to use Evaluate? If we look at the Substitute Function, we'll see what we're doing here. We say take the style, the xstyle, the contents of it and when you use checkboxes you have a return-separated list, we say take all those returns and replace them with pluses. That will look exactly like what the Help File showed us but believe me, it won't work. You have to evaluate it and once you evaluate it, then those plus signs will be red as an actual value that can be understood by this actual function. And then once we're all done with that, then we say give us Add Styles the result. Simple as that. And then when we're done, we've deselected all the text, we have to reselect it so what we do in here is we want the Start and the End. Remember, we could remember our selection size at start. So Start goes right into here but size doesn't fit into End position. So we have to do a little trickery here. Take the Selection Size plus the Selection Start, minus one and that does it for us and so what we get is this. We're able to select something and apply that styling right to it anytime we want. So very dynamic script. Uses a lot of complex techniques. Even if you don't use it in your solution, learn it because it'll help you to build your FileMaker muscles so you can build better solutions. It's all about problem solving. Once you've solved on many problems, you can solve any problem in FileMaker.
TERMS & CONDITIONS OF USE
BY SUBSCRIBING TO THIS SERVICE, YOU ARE CONSENTING TO BE BOUND BY AND ARE BECOMING A PARTY TO THIS AGREEMENT, THE TERMS AND CONDITIONS OF WHICH SHALL PREVAIL IN GOVERNING YOUR RIGHTS OF USE. BY CLICKING THE "BECOME A MEMBER" BUTTON, THE INDIVIDUAL OR ENTITY LICENSING THE PRODUCT ("YOU") IS CONSENTING TO BE BOUND BY AND IS BECOMING A PARTY TO THIS AGREEMENT. IF LICENSEE DOES NOT AGREE TO ALL OF THE TERMS OF THIS AGREEMENT, THE BUTTON INDICATING "BECOME A MEMBER" MUST NOT BE SELECTED, AND LICENSEE MUST NOT INSTALL OR USE THE SOFTWARE.
"VTC" refers to Virtual Training Company,
"You" refers to the user or subscriber.
"Software" refers to the VTC training content and software.
2. LICENSE: VTC hereby grants to You a worldwide, non-royalty bearing, non-exclusive license to use the Software according to the provisions contained herein and subject to payment of the applicable subscription fees.
3. RESTRICTIONS: You may not do any of the following:
Save the Software to Your hard disk or other storage
medium; permit others to use the Software except as specified by addendum;
modify, reverse engineer, decompile, or disassemble the Software; make
derivative works based on the Software; publish or otherwise disseminate
the Software. VTC, Inc., VTC Online University, and the Virtual Training
Company site is owned and operated by VTC, Inc. as a corporation of
All materials on this site are the property of VTC unless otherwise specified. No material from these pages may be copied, reproduced, republished, downloaded, uploaded, posted, transmitted, or distributed in any way. Modification of the materials or use of the materials for any other purpose is a violation of U.S. copyright law and other proprietary rights. For purposes of this Agreement, the use of any such material on any other web site or networked computer environment is prohibited.
4. FEES: The rights granted under this Agreement
are effective only upon payment of the subscription fees, which are
strictly non-refundable other than as expressly provided herein. The
term "monthly subscription" is defined as any 30 day period.
The term "yearly subscription" is defined as one 365 day
period. A yearly subscription ends on the same numerical date as it
began (example July 28, 2004 to July 28, 2005).
The VTC Online University is access to every VTC training tutorial in our library. You pay a flat fee for access to these titles. You are billed according to your renewal selection below, and can renew monthly, yearly, or in any other increment offered. If you choose to be billed monthly, you will be billed every 30 days for the subscription until you request the subscription be cancelled. Our terms of service state that you must cancel a monthly subscription at least two business days before your renewal date. These two days give us enough time to ensure that you will not be charged again.
5. LIMITED WARRANTY: VTC warrants that the Software, if operated as directed, will substantially achieve the functionality described. VTC does not warrant, however, that Your use of the Software will be uninterrupted or that the operation of the Software will be error-free or secure. In addition, the security mechanisms implemented by the Software have inherent limitations, and You must determine that the Software sufficiently meets Your requirements. VTC also warrants that the media containing the Software, if provided by VTC, is free from defects in material from the date You acquired the Software. VTC's sole liability for any breach of this warranty shall be, in VTC's sole discretion: (i) to replace Your defective media or Software; or (ii) to advise You how to achieve substantially the same functionality with the Software as described; or (iii) if the above remedies are impracticable, to refund the subscription fee You paid for the Software. Only if You inform VTC of Your problem with the Software during the applicable subscription period will VTC be obligated to honor this warranty. VTC will use reasonable commercial efforts to repair, replace, advise, or refund pursuant to the foregoing warranty within thirty (30) days of being so notified. If any modifications are made to the Software by You during the warranty period; if the medium is subjected to accident, abuse, or improper use; or if You violate the terms of this Agreement, then this warranty shall immediately terminate. This warranty shall not apply if the Software is used on or in conjunction with hardware or software other than the unmodified version of hardware and software with which the Software was designed to be used as described.
THIS IS A LIMITED WARRANTY, AND IT IS THE ONLY WARRANTY MADE BY VTC OR ITS SUPPLIERS. VTC MAKES NO OTHER WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF THIRD PARTIES' RIGHTS. YOU MAY HAVE OTHER STATUTORY RIGHTS. HOWEVER, TO THE FULL EXTENT PERMITTED BY LAW, THE DURATION OF STATUTORILY REQUIRED WARRANTIES, IF ANY, SHALL BE LIMITED TO THE ABOVE LIMITED WARRANTY PERIOD. MOREOVER, IN NO EVENT WILL WARRANTIES PROVIDED BY LAW, IF ANY, APPLY UNLESS THEY ARE REQUIRED TO APPLY BY STATUTE NOTWITHSTANDING THEIR EXCLUSION BY CONTRACT. NO DEALER, AGENT, OR EMPLOYEE OF VTC IS AUTHORIZED TO MAKE ANY MODIFICATIONS, EXTENSIONS, OR ADDITIONS TO THIS LIMITED WARRANTY.
6. PROPRIETARY RIGHTS: VTC reserves all proprietary rights in and to the Software, is protected by copyright and other intellectual property laws and by international treaties. VTC, Inc.
Trademark Notice: VTC, Virtual Training Company,
Inc., The VTC Logo, and VTC Online University, are trademarks of VTC,
Inc. All other company and product names may be trademarks of their
The information contained herein is subject to change without notice. Copyright © 1995 - 2005 VTC, Inc. All rights reserved.
7. TERMINATION: This Agreement shall automatically terminate if You fail to comply with the restrictions described herein. Your obligations to pay outstanding subscription fees shall survive any termination of this Agreement.
8. LIMITATION OF LIABILITY: UNDER NO CIRCUMSTANCES
AND UNDER NO LEGAL THEORY, TORT, CONTRACT, OR OTHERWISE, SHALL VTC
OR ITS SUPPLIERS OR RESELLERS BE LIABLE TO YOU OR ANY OTHER PERSON
FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF
ANY CHARACTER, INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
COMMERCIAL DAMAGES OR LOSSES. IN NO EVENT WILL VTC BE LIABLE FOR ANY
DAMAGES IN EXCESS OF THE AMOUNT VTC RECEIVED FROM YOU FOR A LICENSE
TO THE SOFTWARE, EVEN IF VTC SHALL HAVE BEEN INFORMED OF THE POSSIBILITY
DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM VTC'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
9. Links To Other Materials: Linked sites found at the VTC site are not under the control of VTC, and we are not responsible for the content of any linked site or any link contained in a linked site. VTC may change links based solely on our discretion, and we reserve the right to terminate any link or linking program at any time. VTC does not, by linking to sites, endorse companies or products to which it links and reserves the right to note as such on its web pages. If you decide to access any of the third party sites linked to this site, you do this entirely at your own risk.
Forums, and Chat are not always screened by VTC, and we are not responsible for the content of any public or open forum content at the site. VTC may change these public forums based solely on our discretion, and we reserve the right to terminate any forum at any time. VTC does not, by allowing these forums, endorse companies or products which may be mentioned in these forums, and reserves the right to note as such on its web pages. If you decide to access any of the public forums in this site, or linked to this site, you do this entirely at your own risk.
9. GOVERNING LAW & DISPUTE RESOLUTION: This Agreement is governed by Virginia law. All disputes between You and VTC shall be finally resolved through arbitration in Winchester, Virginia. This site is controlled by VTC from its offices within the United States of America. VTC makes no representation that materials in the site are appropriate or available for use in other locations, and access to them from territories where their content is illegal is prohibited. Those who choose to access this site from other locations do so on their own initiative and are responsible for compliance with applicable local laws. You may not use or export the Materials in violation of U.S. export laws and regulations. Any claim relating to the Materials shall be governed by the internal substantive laws of the Commonwealth of Virginia, USA.
VTC may revise these Terms at any time by updating this posting. You should visit this page from time to time to review the then-current Terms because they are binding on you. Certain provisions of these Terms may be superseded by expressly designated legal notices or terms located on particular pages at this Site.
If you have any questions regarding this policy,
or your information specifically,
you may email us at:email@example.com.