Previous Page TOC Next Page



23


Automation with FrontPage's WebBots


by William Robert Stanek

WebBots greatly streamline the development process and eliminate the need to write your own scripts or add complicated HTML commands. With a WebBot you can collect the results from forms, automatically add navigation bars, create pages with full text searches, allow registered users to access key areas of your Web site, and much more. There is no programming involved at all.

How to Use WebBots


Throughout this book, I have talked about bots. As you have seen, you can use bots to automate many Web publishing tasks.

The FrontPage Editor makes the process of adding WebBots to pages very easy. The first step is to move the insertion point where you want the bot. Next, click on the WebBot icon (the robot) on the standard toolbar or open the Insert menu and select WebBot Component. On the WebBot Components window, shown in Figure 23.1, select the bot you want to use by double-clicking on the appropriate keywords. Alternatively, you can select the appropriate key words then click on the OK button or press Enter on the keyboard.

Figure 23.1. Inserting bots onto the page.

In FrontPage, the WebBot maintenance process is also very easy. When you move your pointer over an area of the page containing a WebBot, the pointer changes from an arrow to a robot. The robot icon indicates that a bot is embedded in this area of the page. You access a properties dialog box associated with the bot by double-clicking when the robot icon is visible. With this dialog box open, you can change the characteristics of the bot.

How do WebBots Work?


FrontPage includes more than a dozen WebBots. You can think of each WebBot as a program or script that runs when needed.

Some WebBots affect your Web site only when you add or update the bots in the FrontPage Editor. This means they have no effect when a user browses the Web. Most WebBots automatically update themselves at runtime. This means the bots either run immediately when viewed or start when the user performs an action in the page, such as submitting a fill-out form. Bots that run immediately make updates to the page in browsers and in the FrontPage Editor.

All WebBots that automatically update themselves at runtime depend on FrontPage server extensions. Therefore, you must either use the Personal Web Server to provide Web services or install the FrontPage server extensions for your server.


CAUTION

If you cannot use the FrontPage server extensions with your server, you are going to have problems with many of the WebBots. The following are the primary bots to watch out for:

These bots execute when a user submits a fill-out form and will not work without the FrontPage server extensions. Other bots might present problems as well because they add material to the page when loaded into a browser.



Using The Confirmation Field WebBot


The Confirmation Field WebBot echoes a user's input to a form on a special page called a confirmation page. You can create confirmation fields for forms handled by Save Results bots, Discussion bots, and Registration bots. However, you must specify the URL of a confirmation page that you create to hold the input.

Specifying the Confirmation Page


You can specify the confirmation page at any time by accessing a pushbutton element's properties box and clicking on the Form button. This opens the dialog box shown in Figure 23.2. After you choose the appropriate handler from the pull-down menu in the Form Handler area of the Form Properties box, click on the Settings button to define settings for the handler.

Figure 23.2. Selecting a form handler.

The Save Results handler has three configuration pages that you can access by clicking on the Results, Confirm, or Advanced tab. You can specify the confirmation page's URL in the URL of confirmation page field of the Confirm tab, as shown in Figure 23.3.


TIP

The Registration handler and the Discussion handler similarly have Confirm tabs that allow you to define a confirmation page. In addition to defining a confirmation page, you should also define a validaiton failure page. This page is displayed anytime the validation processing fails, and it highlights what went wrong so that the user can make corrections as necessary.


Figure 23.3. Setting a confirmation page for the Save Results handler.

Associating fields with Values


Chapter 12, "Using Forms and the Forms Wizard," explored how to create forms. As you might recall, each input field has two attributes:

When you create a form, you should note the names of each field that you want to echo on a confirmation page. With this list of field names, you can open your confirmation page and insert the Confirmation Field bot as appropriate. You must insert one bot for each field that you want to confirm.


TIP

To view the properties for any field, open the properties dialog box associated with the field by moving the mouse pointer over the field and double-clicking.


To use this bot, select Confirmation Field from the WebBot Components dialog box. This opens the dialog box shown in Figure 23.4. In the Name of Form Field To Confirm field, enter the name of the form field you want to echo on this page. For all form fields except radio buttons, use the name in the Name field. For radio button fields, use the name in the Group Name field. When you are finished, click on the OK button.

Figure 23.4. Using the Confirmation Field bot.


NOTE

You should use this bot only on form confirmation pages. When the reader displays the page, the Confirmation Field bot updates the field and your page appears with appropriate values.



The Confirmation Field WebBot in Action


Before you use the Confirmation Field bot, you should create a fill-out form such as the one shown in Figure 23.5. This form lets registered users submit questions to the company's customer support staff. The form asks for key information that confirms the identity of the user.

Figure 23.5. A customer support form for registered users.

You should appropriately name each input field in the form. For this example, the fields we want to track are the user's account number and e-mail address. To verify the field names, you can open the properties box associated with the input field. Figure 23.6 shows the properties box for the input field for the user's account number. Note that the name of the field is Account_number. You should write all the field names down on a piece of scratch paper.

Figure 23.6. Verifying field names.

Next, you should ensure that you have set an URL for the confirmation page. Afterward, you can create a confirmation page, such as the one shown in Figure 23.7. When you insert of Confirmation Field bot, the bot asks you to enter the name of the field, which is then inserted into the page within square brackets. This page has two confirmation fields, one for Account_number and one for Account_email. You can update the properties of these bots at any time by moving the mouse pointer over the confirmation field and double-clicking.


NOTE

At the bottom of Figure 23.7, you'll see a two-link navigation menu within square brackets. Do not confuse the confirmation fields in square brackets with a similar technique used to highlight navigation links.


Figure 23.7. A typical confirmation page.

Using the Discussion Bot


Discussion groups enable users to interact on the Web, and the Discussion bot automates this process. Creating discussion groups and using the Discussion bot handler is the subject of Chapter 39, "Creating and Managing Discussion Groups."

Using the Include WebBot


The Include bot helps create standardized page sections throughout your Web by enabling you to merge a page into an existing page. This function was used in many of the pages created by the Web templates and wizards in the previous chapter to add standard headers, footers, and navigation bars to pages.

When you view a page in a browser or in the FrontPage Editor, all Include bots are replaced with the contents of the pages they reference. These pages must come from the same Web. If you change the contents of a page referenced by an Include bot, the change is made to every page in the Web that has the Include bot inserted in it.


TIP

Sometimes you might not want a page that you are including to be accessible to those who visit your Web site. If this is the case, create a subdirectory within your Web site called _private and store the page in this directory. Visitors to your Web cannot access files in the _private directory.


To insert the Include Bot into a page, click on the WebBot icon on the standard toolbar or open the Insert menu and select WebBot Component. On the WebBot Components window, select the Include bot by double-clicking on the word Include. Alternatively, you can select Include and then click on the OK button or press Enter on the keyboard. This opens the dialog box shown in Figure 23.8.

Figure 23.8. Using the Include bot.

In the Include Bot Properties box, enter the URL of the page to include. If you do not know the URL of the page, click on the Browse button to select a URL from a list of page URLs in the current Web. When you are finished, click OK to close the Include Bot Properties box.

When you close the box, you see a message telling you that FrontPage is retrieving the included page and inserting it into the current page. You cannot edit any elements contained on the included page. You must open and edit the original page to make any changes.


TIP

You can insert material before an Include bot that is the first element on the page. Simply move the insertion point before the included elements and press Enter. Alternatively, you can select the included elements by clicking on them and pressing Enter.



Using the Registration WebBot


By default, all users have access to your Web. You can restrict access to a Web in two key ways:

In both instances, when a user tries to enter the restricted Web, the Registration bot asks him to enter his user name and password using the dialog box shown in Figure 23.9. If the user has not registered with the Web and tries to enter information in this dialog box, the Registration bot takes him to a page set up for registration failures. From this page, he can get to the registration form.

Figure 23.9. Users must specify user name and password to access restricted Webs.

If the user has registered with the Web, the Registration bot grants him access to the Web and remembers his user name and password throughout the current session. However, the next time the user visits the Web, he will be prompted again for his user name and password, which again will be good for an entire session.


CAUTION

The Web administrator and any other users registered by the Web administrator can access the restricted Web. For this reason, you should always use very secure passwords, especially for the Web administrator. I recommend using a password that is at least six characters long that includes numbers and wild card characters, such as !, @, #, $, and ?.


The first method allows any user to access a Web as long as he registers beforehand. A user is typically able to register using a simple registration form that asks him to select a user name and password, which means access to the Web is virtually unlimited. The next section covers creating registration forms.

The second method allows only a specific set of users to access a Web. The Web administrator grants these users access, and each user must specify the user name and password that the administrator assigned him in order to enter the Web. At any time, the Web administrator can revoke the access privileges. Restricted access Webs created by Web administrators is covered in Chapter 38, "Managing Security for the Personal Web Server."

Creating a User Registration Form


To allow users to register for a Web, you must create a registration form. Because of the way permissions are set, you should always register users using a form page located in the Root Web. This form should grant them access to another Web at your site.


NOTE

For instance, if your Web site is at www.tvp.com, then your Root Web is at

To register users for the corppres Web at http://www.tvp.com/corppres/, you would create a registration form that was located in the base Web, such as



In the FrontPage Explorer, open the Web you want to register users for, then select Permissions from the Tools menu. This opens the Web Permissions dialog box shown in Figure 23.10. In the Settings tab, select Use Unique Permissions For This Web, and then click on the Apply button.

Figure 23.10. Setting Web permissions.

Next, in the End Users tab shown in Figure 23.11, select Registered Users Only, and click on the OK button, which closes the dialog box.

Figure 23.11. Setting user permissions.

Now, open the root Web. To do this, select a Web server or file location, then click on the List Webs button. The first entry in the FrontPage Web's field should be labeled as <Root Web>. With the root Web as your current Web, you can now open a new page in the FrontPage Editor and save it to the root Web. Start by selecting New from the File menu. In the New Page dialog box, select the User Registration template, and click on the OK button.

You can use the page created by the editor as the basis for your registration page. Delete any text that you do not want to include and change the text associated with the registration form as appropriate for your Web. Next, check the names associated with each input field.


CAUTION

The field names must exactly match the names used by the Registration handler. If they do not match, users will not be able to register for your Web. Unfortunately, the Registration bot is not smart enough to ensure these fields match, and whenever users try to register, the bot will display a failure page with a misleading error message such as "You must specify a user name."



Configuring the Registration WebBot


Now that you have created a registration page, you need to configure the Registration bot for use on your Web. With the registration page open, select any pushbutton field and open its properties box, and then click on the Form button to open the Form Properties box. The Registration bot should be selected as the Form Handler by default. Next, click on the Settings button to define settings for the handler. This opens the dialog box shown in Figure 23.12.

Figure 23.12. Configuring the Registration handler.

As you can see from Figure 23.12, the Registration handler has four configuration pages. You can access these by clicking on the Registration, Results, Confirm, or Advanced tab. Although the Registration tab contains unique settings, the Results, Confirm, and Advanced tabs are exactly the same as those used for the Save Results handler, covered in "Saving the Results of the Form" in Chapter 12.

The first tab you should look at is the Registration tab. In the Web Name field, enter the name of the Web for which you are registering users. The name must match the Web name as shown in the Open Web dialog box.

All registration forms should have user name, password, and password confirmation fields. You should verify that the field names you used in your registration form match those shown in the Registration tab. If they do not match, enter the correct field names.

If you want to ensure that users have passwords that follow sound security practices, check the Require secure password field. In FrontPage, a secure password has 6 or more characters and does not partially match the user name.

The final field you might want to specify information for is the URL of registration failure page field. All registration forms use default failure pages unless you specify another page. Figure 23.13 shows a failed registration using the default failure page. Although the default page is fairly basic, it gets the job done.

Figure 23.13. The default page for failed registrations.

Next, you should review the settings in the Results, Confirm, and Advanced tabs. The key field you should check is the URL for the confirmation page in the Confirm tab. All registration forms use default confirmation pages unless you specify another page.

Figure 23.14 shows a confirmed registration using the default confirmation page. This page confirms the user's registration and lets them access the restricted Web. To ensure that users can register for your Web, your home page in the Root Web should have a link to the registration page.

Figure 23.14. The default page for confirmed registrations.

Using the Save Results WebBot


The Save Results bot lets you save form data to a file or database. This is the most common type of form handler. For detailed information on the Save Results Bot, see "Saving the Results of the Form" in Chapter 12.

Using the Scheduled Image WebBot


Sometimes you might want to display images at your site for a specific period of time. For example, an advertiser wants to run a 2-week ad in your magazine. You sign the advertiser to a contract stating this and ask him to specify the start date of the advertisement. Armed with this information, you place a Scheduled Image bot on the pages where the ad will appear and schedule it so the ad begins on the advertisers start date, displays for 14 days and then is replaced with your standard logo.

The previous example gives one instance of when you might want to use the Scheduled Image bot. Obviously, there are many other times when you might want to use this bot. The primary reason to use this bot is to include an image in a page with the intent of replacing the image at a later date and time.


CAUTION

The Scheduled Image and Include bots execute only when changes occur to a Web. Thus, to ensure that the Scheduled Image or Include bot runs when you want it to, you should make some type of change to your Web daily, such as incrementing the value of a configuration variable.


To insert the Scheduled Image bot into a page, click on the WebBot icon on the standard toolbar or open the Insert menu and select WebBot Component. In the WebBot Components window, select the Scheduled Image Bot by double-clicking on Scheduled Image. Alternatively, you can select Scheduled Image then click on the OK button or press Enter on the keyboard. This opens the dialog box shown in Figure 23.15.

Figure 23.15. Using the Scheduled Image bot.

In the Scheduled Image Bot Properties box, enter the URL of the image to include. If you do not know the image's URL, click on the Browse button to select a URL from a list of images in the current Web.

Next, you can specify the dates when the image should appear on the page. In the Starting Date and Time field, enter the starting date using the drop-down lists to select the year, month, day, and time as appropriate. Initially, the start time is set to the current date and time.


NOTE

If the Starting Date and Time is earlier than the current date and time, the image appears on the page immediately.


In the Ending Date and Time field, enter the date to stop including the image. Initially this field is set to a calendar date approximately 30 days from the current date. The final field you can define is for an optional image to display when the included image is not being displayed. Click on the Browse button to select a URL from a list of images in the current Web. Click OK to close the properties box.

Using the Scheduled Include WebBot


Sometimes you might want to display a standard header, footer, or section of a page for only a specific period of time. With the Scheduled Include bot, you can insert a page into the current page for a fixed time period.

To insert the Scheduled Include bot into a page, click on the WebBot icon on the standard toolbar or open the Insert menu and select WebBot Component.On the WebBot Components window select the Scheduled Include bot by double-clicking on Scheduled Include. Alternatively, you can select Scheduled Include then click on the OK button or press Enter on the keyboard. As you can see from Figure 23.16, you configure this bot almost identically to the Schedule Image bot.

Figure 23.16. Using the Scheduled Include bot.

In the Scheduled Include Bot Properties box, enter the URL of the page to include. If you do not know the page URL, click on the Browse button to select a URL from a list of pages in the current Web. Next, specify the dates when the Include should appear in the page. In the Starting Date and Time field, enter the starting date. If the starting date and time is earlier than the current date and time, the page appears immediately.

In the Ending Date and Time field, enter the date to stop including the page. You can also define a page to display before and after the scheduled page appears. Click on the Browse button to select a URL from a list of pages in the current Web. When you are finished, click OK to close the properties box.

Using the Search WebBot


The Search bot provides a full text-searching capability for your Web. When a user submits a form created by the Search bot, the Search bot returns a list of all pages in the current Web containing the user's search words. The user can then access any of the pages by clicking on the page title.


NOTE

You can place any pages that you do not want users to search, such as header and footer pages, in a subdirectory called _private. The Search Bot does not search in this directory.


The Search bot is the only bot that creates its own search form that you can place on any page. To insert the Search Bot and its associated search form into a page, click on the WebBot icon on the standard toolbar. Next, select the Search bot in the WebBot Components dialog box. This opens the dialog box shown in Figure 23.17.

Figure 23.17. Using the Search bot.


TIP

You can also use the search page template to create a new page with a search form. A key reason to use this template is that it includes detailed information on the query language that the user might need.



Conducting a Search with the Search Bot


A sample search form appears in Figure 23.18. In the search form, I entered the search words: writer and writing. When I click on the Start Search button, the Search bot conducts a full-text search of the current Web and inserts the results into the current page.

As you can see in Figure 23.19, the Search bot found 82 documents matching the search criteria. Because the Search bot was set up to return a score, file size, and file date, documents containing the search words were ranked by these three criteria.

Figure 23.18. A sample search form.

Figure 23.19. The Search bot returns the results.

Configuring the Search Bot and the Search Form


To customize the search form and the search results, change the Search bot's default property values. As Figure 23.17 showed, the Search Bot Properties box has two key areas.

The Search Input Form area defines the way the search form looks in your Web page. The form is very simple, with a label for the input box, a one-line text box that accepts input, and two labeled buttons. To change the way the form looks, simply change the default labels. Here's a list of the fields and how they are used:

Label for Input The label for the one-line text box. The default is Search For:.
Width in Characters The width of the one-line text box. By default the character width of the text box is 20.
Label for "Start Search" button The label for the button that starts the search. The default is Start Search.
Label for "Clear" button The label for the button that clears the form. The default is Reset.

The Search Results area defines the ways you can manipulate the results of a search. Results appear based on matches for the search words and can be ranked by the following criteria:

Score The scoring mechanism tries to rank the relevancy of the page based on the number of times the search words appear on the page.
File Date The date the file was created or the last time the file was updated.
File Size The size of the file.

TIP

Although scoring is the most common way to rank the relevancy of files, many Web publishers prefer to use all three ranking statistics. The file's modification date tells the user how current the document is. The file's size indicates how much data the file contains.



Using the Substitution WebBot


Just as you might sometimes want to insert standard headers and footers into your pages, you might also want to include standard segments of text. For example, most pages include contact information. Wouldn't it be great to be able to instantly change the contact information if one of the addresses is no longer valid? Well, with the Substitution bot, you can make instant updates to your pages.

To insert the Substitution bot into a page, click on the WebBot icon on the standard toolbar or open the Insert menu and select WebBot Component.In the WebBot Components dialog box select the Substitution bot. This opens the dialog box shown in Figure 23.20. The Substitute with field has a pull-down menu that lets you select any of the default configuration variables, as well as any configuration variables that you have added to the Web.

Figure 23.20. Using the Substitution bot.

Using Default Configuration Variables


When a reader views a page containing a Substitution bot, the bot replaces a temporary variable with its value. This variable is called a configuration variable because the Web administrator can configure it and is valid throughout the Web.

FrontPage tracks key information for all pages created, such as who created the page and who last modified the page. To view the settings for the default variables associated with any page, select the page in the FrontPage Explorer, and then open the Properties dialog box by selecting Properties from the Edit menu or by pressing Alt+Enter.

As you can see from Figure 23.21, the Properties dialog box has two tabs: General and Summary. Four default configuration variables are defined by the fields in the Summary tab:

Author The user name of the person who created the page, as defined in the Created by field of the FrontPage Explorer's Properties dialog box.
ModifiedBy The user name of the person who most recently modified the page, as defined in the Modified by field of the FrontPage Explorer's Properties dialog box.
Description A description of the current page, as defined in the Comments field of the FrontPage Explorer's Properties dialog box.
Page-URL The page URL of the page, as defined in the Page URL field of the FrontPage Explorer's Properties dialog box.

Figure 23.21. The FrontPage Explorer's Properties box.

Defining New Configuration Variables


Defining new configuration variables is easy. Start by selecting Web Settings from the FrontPage Explorer's Tools menu to open the Web Settings dialog box shown in Figure 23.22. The Web settings dialog box has three tabs. The Parameters tab shows any user-defined configuration variables, and you can use it to add, modify and remove user-defined configuration variables.

Figure 23.22. The Parameters tab.

To add a configuration variable, click on the Add button, which opens the Add Name and Value dialog box shown in Figure 23.23. In the Name field, enter the name of the configuration variable you want to define. Although the name can be any length, it cannot contain the colon character (:). In the Value field, enter the value you want associated with the new configuration variable. The value can be a text string of any length. When you are done, click on the OK button. Repeat the procedure to define additional configuration variables.

Figure 23.23. Defining new configuration variables.

Using the Table of Contents WebBot


Like an index, a table of contents is useful but usually difficult to build and maintain. FrontPage allows you to instantly add a table of contents to your Web.

FrontPage builds the table of contents by examining all the links contained in the top-level page you specify and then recursively examining the lower level pages for links to other pages. If the Web contains pages that are not linked to any other pages, these pages are either excluded (by default) or included (by selecting a property setting for the bot that builds the table of contents).

To build a table of contents for the current Web, insert the Table of Contents bot into a page or create a new page based on the Table of Contents template. To set properties for the Table of Contents, open the bot's properties box, which is shown in Figure 23.24.

Figure 23.24. Using the Table of Contents bot.

Each of the fields in the properties box enables you to customize the table of contents. You can use these fields as follows:

Page URL for Starting Point of Table Enables you to specify the URL of the top-level page you want the bot to examine and build the table of contents from. If you do not know the page URL, click on the Browse button to get a list of pages in the current Web.
Heading Size Enables you to specify the size of the heading to use for the first entry in the table of contents. If you want no headings, select none.
Show each page only once Ensures that each page appears only once in the table of contents. Otherwise, pages linked from more than one page will be listed once for each link.
Show pages with no incoming links Ensures pages not linked to other pages appear in your table of contents.
Recompute table of contents when any other page is edited Ensures that the table of contents is automatically updated when any page in the Web is edited.

NOTE

Rebuilding the table of contents can be a time-consuming process, especially for large Webs. You can manually regenerate the table of contents by opening and saving the page containing the Table of Contents bot.



Using the TimeStamp WebBot


Telling visitors to your Web when a page was last modified is useful, especially if you plan to make frequent updates to your Web. Use the TimeStamp bot to do this.

To insert the TimeStamp bot into a page, click on the WebBot icon on the standard toolbar or open the Insert menu and select WebBot Component. In the WebBot Components window, select the TimeStamp bot by double-clicking on TimeStamp. Alternatively, you can select TimeStamp and then click on the OK button or press Enter on the keyboard. As you can see from Figure 23.25, you configure this bot almost identically to the Schedule Image bot.

Figure 23.25. Using the TimeStamp bot.

In the Display field in the TimeStamp Bot Properties dialog box, select the type of page modifications you want to track. A page is considered "edited" when you save it to the server. A page is considered "updated" whenever FrontPage touches the document. This happens when you save the page to the server, when you upload the page to a Web, and when the page's links are recalculated.

Your timestamp can include both a date and a time. Select the date format from over a dozen styles using the Date Format field's drop-down menu. Select the time format from one of three time formats in the Time Format field's drop-down menu. If you do not want to use a date or time, you can choose the drop-down menu option None. Although both the Time Format and Date Format fields allow you to select None, you should not set both fields to None, because that defeats the purpose of using the TimeStamp bot.

Summary


FrontPage includes more than a dozen WebBots. WebBots are useful for automating even the most advanced tasks, and can be easily added to any page. Some WebBots only affect your Web when you add or update the bots in the FrontPage Editor. Most WebBots automatically update themselves at runtime. Bots that run immediately make updates to the page in browsers and in the FrontPage Editor.

All WebBots that automatically update themselves at runtime depend on FrontPage server extensions. Therefore, if you plan to use WebBots that execute at runtime, you must either use the Personal Web Server to provide Web services or install the FrontPage server extensions for your server.

Previous Page Page Top TOC Next Page