Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Schongar P.VBScript unleashed.1997

.pdf
Скачиваний:
43
Добавлен:
23.08.2013
Размер:
1.59 Mб
Скачать

in the Office Suite and used it to create a variety of documents, including reports, presentations, spreadsheets, and so on. These documents are the result of several man hours of work and effort that has been put in over the past several years. If you are building a company-wide intranet for your organization, it is highly beneficial if you provide easy access to such documents to your users. The popularity of the browser and the ability to use it as a one-stop point to access information from both the Internet and intranet makes it a natural candidate for linking it with your company documents.

Let us take a step back and review the OLE technology. Using OLE, you can embed a Microsoft Excel spreadsheet, for example, within your Microsoft Word document. This lets you open an Excel spreadsheet by double-clicking it within your Word document without having to explicitly open Microsoft Excel. In addition to spreadsheets, you can embed Word, PowerPoint, and other OLE-enabled documents. This improves productivity, because you don't need to worry about the format and location of the documents or the application needed to open such documents. Listing 16.3 shows the HTML code for a Web page displaying three types of documents: Microsoft Word, Microsoft Excel, and Microsoft PowerPoint. Figure 16.6 shows the resulting Web page. Notice the hot spots on the Web page. They do not really indicate the format of the document. If you click any hot spot, the appropriate application opens the document referenced.

Figure 16.6 : A simple Web page with hot spots to Word, Excel, and PowerPoint documents.

Listing 16.3. HTML for a Web page displaying three types of documents.

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><HTML><HEAD><TITLE>

VBScript Unleashed

</TITLE></HEAD><!--DocHeaderStart--><BODY leftmargin=8 bgcolor="#FFFFFF"

VLINK="#666666" LINK="#FF0000"><FONT FACE="ARIAL,HELVETICA"

SIZE="2"><!--DocHeaderEnd-->

<P><h2>VBScript Unleashed

</h2><P><!--DATE-->September 1, 1996<P><!--/DATE-->

<P><A HREF="order.doc">This is a Microsoft Word document<P>

<P><A HREF="revenuesxls">This is a Microsoft Excel document<P>

<P><A HREF="vbscript.ppt">This is a Microsoft PowerPoint document<P>

<!--DocFooterStart--></FONT><FONT FACE="MS SANS SERIF" SIZE="1"

COLOR="BLACK"><A HREF="/Misc/cpyright.htm" target="_top">©

1996 Sams.net</A></FONT><!--DocFooterEnd--></BODY></HTML>

Using the browser as the one-stop point to access the Office documents helps improve productivity and provide an easy-

to-use interface. Again, you don't need to worry about the format of the documents and the applications needed to open such documents. If your browser were not able to open your Office documents, you would have to switch from your browser window to your Windows desktop, open Microsoft Word or Microsoft Excel, open the application, and use the File | Open menu command to open the document of interest. Imagine if you had to do this for each and every Office document! It is a multistep process that affects productivity adversely.

The ability to provide access to your Office documents from the Web browser lets you leverage your investment in the Office Suite and documents created using it. You get an easy and simple to use access point and at the same time retain your investment in the office documents.

Integrating your browser with Office documents also lets you initiate some creative applications for your corporation. If your corporation has been distributing employee handbooks for several years, you can port the employee handbook onto your company-wide intranet. You can use Office Suite to create the electronic form of the employee handbook. Your company employees can view it using the browser. Similarly, the human resource department of your company can place its policies handbook on the intranet. These solutions offer significant cost savings. The cost of maintenance reduces substantially. Every year you can update your intranet-based employee and human resource policy handbooks easily and quickly. It virtually eliminates the cost of printing and distribution of such handbooks.

NOTE

Using an intranet for document sharing with a browser is more costeffective than a specialized solution such as using Lotus Notes. Using a browser provides an easy-to-use, universal interface. It reduces the learning curve for the users. Using Lotus Notes requires investment of time and money in learning how to use and deploy it effectively.

Microsoft Office Suite

The Microsoft Office Suite is presently the most popular application in the marketplace. It offers a complete solution for your day-to-day business needs. New features such as the binder help you integrate your Word, Excel, and PowerPoint documents seamlessly into one document. On the other hand, the browser is presently the most popular user inteface in the marketplace. Its hyperlink capabilities, combined with the ease of use and presentation, makes it a great interface for navigating the Internet and intranet. It also make a great interface for browsing your desktop. In fact, there are indications that Microsoft is planning to integrate the browser interface into the next release of its Windows operating system and do away with the Windows Explorer and File Manager style interface. It remains to be seen if and when such technology becomes available. If your company has standardized on Microsoft Office Suite applications but has some Lotus or WordPerfect documents, you can still view them using your Office Suite applications. This is discussed in detail later in this chapter.

NOTE

Following are a few guidelines to follow when setting up your intranet for viewing Microsoft Office Suite documents using your favorite browser.

Collect all the old and new documents and accumulate them in a single location. This includes Microsoft Office and non-Microsoft Office documents and documents created using older versions of Word, Excel, and PowerPoint. This would be a good point to discard all documents you think you do not need any more.

If your company has standardized on the Microsoft Office Suite, consider upgrading the documents that were created using older versions of Word, Excel, and PowerPoint. This provides a common framework for all the documents.

Consider converting any documents that were created using nonMicrosoft Office Suite applications. For example you can convert Lotus AmiPro documents into Microsoft Word format. Although this type of conversion is not necessary, a standard format improves maintenance and ease of use.

If your company has not standardized on a single package but uses several different suites in different departments, consider including all format specifications.

Organize your documents by functionality or department, depending on how your organization works.

When you open a Word or Excel document from your browser, a local copy is opened. The master copy resides on the server. Therefore, any changes made are reflected only in the local copy and not in the master copy. Using your browser to read Office documents promotes collaborative work. Documents can be shared between group members freely and easily. For example, if you are working on a sales spreadsheet and the sales data should be made available to everyone else in your group, you can upload its copy onto the server. The uploaded document becomes available to everyone else in the group who can access it directly from their Web browser.

NOTE

Because the document opened by the browser is a local copy, this setup does not support collaborative work in the true sense. It is still a very costeffective solution, compared to the price points of some specialized groupware applications such as Lotus Notes.

NOTE

If the browser displays an error message indicating it cannot load the

Microsoft Word document, try this:

Check available system resources

Close any other Windows applications that may be open

Applications such as Word for Windows are very resource-hungry.

NOTE

Make sure you have set the right access for the network directories that contain the Office documents. If you want to provide read-only access to these documents, make the directory read-only.

NOTE

Microsoft's Internet Assistants for Word, Excel, and PowerPoint help you convert word processing, spreadsheet, and presentation documents into HTML and vice versa. These Internet assistants can be downloaded from Microsoft's Web site.

Relevant Web Sites

Table 16.2 lists a few relevant Web sites. There are plenty of resources and examples available on the Net.

 

Table 16.2. Relevant Web sites.

Site Name

Site URL

Microsoft

http://www.microsoft.com/activex

ZD Net

http://www.zdnet.com/activexfiles/

ActiveX Developer Support

http://activex.adsp.or.jp/

CMP Media Inc.

http://www.activextra.com/

Review

Microsoft Office is the most popular Office Suite product in the market today. Office products including Word, Excel, and PowerPoint have been in use since before the introduction of the browser. By extending your browser to access Word, Excel, and PowerPoint documents, you can leverage your investment in Office products and provide an easy-to- use, one-stop interface to your users. This boosts productivity tremendously.

Keep in mind the following guidelines when configuring your intranet for viewing Microsoft Office Suite documents using your favorite browser:

Collect all old and new documents and accumulate them in a single location. Discard any documents you think you do not need any more.

If your company has standardized on the Microsoft Office Suite, upgrade the documents that were created using older versions of Word, Excel, and PowerPoint.

Convert any documents that were created using non-Microsoft Office Suite applications.

If you want to provide read-only access to your documents, consider using the free application viewers from Microsoft. They can be downloaded from Microsoft's Web site: http://www.microsoft.com.

This chapter discussed how you can use ActiveX Control Pad to integrate ActiveX controls into your Web pages. Microsoft Internet Explorer 3.0 includes full support for VBScript and ActiveX controls.

From here, refer to the following chapters for further reading:

Chapter 15, "Creating Active Documents for Corporate Intranets," to learn how to create active documents on your corporate intranets.

Chapter 21, "Safety and Security," to learn how to maintain security and safety when deploying VBScript-based Web applications.

Chapters 23-27 include examples of VBScript-based applications. Review the code to understand how VBScript meshes with HTML.

Chapter 15

Creating Active Documents for Corporate Intranets

by Bill Schongar

CONTENTS

Client-Side Processing

Distributed Applications

Databases

Functionality and Flexibility

Native Document Hosting

Component Architecture

Third-Party Innovation

Return on Investment (ROI)

Maintenance

Expansibility and Integration

Standards

Investment Protection

Employee Efficiency

Company Image

Review

Are intranets just a bunch of hype? Corporate networks for sharing resources between departments and across locations aren't anything new; local area networks (LANs) and wide area networks (WANs) have been in mainstream use for well over 10 years. The infrastructure and the technology used to turn a LAN into this amorphous thing called an "intranet" isn't anything new and spiffy either, because the basic communications protocol used to power an intranet, in the form of TCP/IP, has been around for quite a while as well. So what's so brand spankin' new that it needs all the publicity? The feeling of "new" comes from the way the network is being used.

If you think about a basic file-sharing network, you have a server (or any multiple of one that suits your needs) and a bunch of files resident on a drive. That's all you get. If you need the latest copy of the company financials, you have to make sure you get access to accounting's drive, figure out where the file is, figure out what its filename is, and then make sure that you have something to read that file format. What, you don't have XYZ accounting software? Back to square one. E-mail the folks in accounting and ask for a hard copy. What a welcome to the age of technology. To the end user there is no interrelation of data, no reasonably clear method of general organization (unless you count being able to decipher DOS-style 8.3 format filenames as an efficient method of organization), and no leeway for incompatible data formats. What you need is an intranet.

The relationship between, and organization of, pieces of information is just as important as being able to view the information in the first place. Intranets are built on organization and interrelation, because they're designed as a way to share information, not just files. When you look for the corporate financials, you might expect to find a link to performance by month or by quarter, maybe by department or product. These in turn may have other factors involved in their creation, and you should be able to track them all down with just a quick click of the mouse. When you want to

submit a request, you shouldn't have to track down a paper copy of a form and then get it checked, processed, and tossed into the mysterious depths of getting approval. You should be able to go to an easy-to-find location, find the form you need, fill it out online, have error-checking done for you, receive confirmation that you submitted it, and be done with it. That's not too unreasonable, is it?

In short, an intranet is all about getting the most bang for your information buck. This is where ActiveX and VBScript make the difference. You can add powerful functionality and flexibility to your intranet without breaking a sweat. Users can update data in its native format, not worrying about conversion to some static chunk of HTML or a graphic. Want a spreadsheet? No problem. Want a multimedia slide show? You got it.

Want client-side processing, self-updating distributed applications, complete design flexibility, and some free time? You can have it all, and we'll show you how. In this chapter we'll focus on elements of ActiveX and VBScript that power your intranet to new levels, including

Client-Side Processing

Distributed Applications

Native Data Formats

Return on Investment

Whether you already have an intranet, or are trying to justify the expenses associated with creating or improving one, this chapter will show you how ActiveX will kick your site into high gear, at a price point you can live with and with functionality you won't be able to live without.

Client-Side Processing

1Mbps, 10Mbps, 100Mbps.... Let's face it, the network is never fast enough. No matter how fast you improve your network, something will come out that sucks up all the speed you have available, and then some. The more users you add to that lightning-fast server, the more all that speed seems like just another flash in the pan. The only way you can ever get a server to reach its true potential is to offload the menial tasks onto some other machine. Well, how about the users who are accessing the network? They have connected computers that could take on responsibility for their tasks, don't they?

Client-side processing is an increasingly important aspect of client/server computing. At first, it was enough that the two computers could talk to one another, and the server could be the processing powerhouse. That's akin to calling Julia Child and asking her to cook you dinnerif you have access to all the instructions and materials, why can't you do it yourself? Sure, an expert can probably do something faster and better, but if dozens of people call up with the same request over and over again, it's not going to be faster to wait for the expert than it would be to do the work yourself. Client-side processing gives the server a break, because it means you can download everything you need to do a job, and the server only has to process a fraction of what you really need, for tasks that require shared resources that your machine can't handle by itself.

ActiveX and VBScript are true client-side enabling technologies. You don't run embedded VBScript the way that you run a CGI program, where you call to the server, it thinks about it, it responds, and you repeat the cycle until you get what you want. VBScript is downloaded and run in your memory space, on your processor, with no network bandwidth taken up for paltry data operations like validating forms output. Do you really want to take up even a fraction of available server resources telling someone he forgot to enter an extension on his phone number, or a departmental billing number?

It's exactly these kinds of basic but necessary operations that VBScript and ActiveX can provide instant benefit in. Let's take the example of client-side forms validation in a little more detail, starting with the traditional method. First, the server has to download the form, which in and of itself is pretty static. Next, the user has to enter data. Any validation of that data has to initiate a connection to the server, the server has to start a process to evaluate the data, establish a connection to respond, and the end user has to receive it. Now, if this is a form that's accessed by one or two people twice a day, that's not very significant. If, on the other hand, this is one of a thousand such forms that on average get hit

hundreds of times an hour, the processing savings for the server are significant, and the total performance benefit for users is extremely high. After all, what's faster-negotiating a conversation with a network server or communicating with a program resident in memory on your local machine?

Distributed Applications

Proceeding to the next level of client-side processing, you encounter distributed applications. More than just a script here and there, fully distributed applications provide the end user with all the files he needs to run a full-fledged application. Typical network installation of applications designed to be distributed is either localization of the programs' executables and support files on a drive that everyone runs them from, or asking users to go to that drive and download all those files locally. "Activated" applications can be fully functioning combinations of ActiveX and VBScript components working together, where it's downloaded once, automatically, and automatically updated to the latest version when it needs to be, by just a visit to a specific page.

What kinds of distributed applications are possible, and logical, for the corporate intranet environment? Here are just a few:

Order Processing

Training Materials

Inventory Controls

Data Warehousing Clients

Scheduling Applications

The point of distributed applications is one you're already familiar with-keeping efficiency maximized. Fully distributed applications put the majority of the processing load on the client, rather than the server. This shouldn't be equated to isolation from the server. Far from it! Distributed applications don't need to be completely stand-alone applications, in that they would need to download a database file or similar shared resources, but the majority of the action taken on those resources should be done without the server's intervention. Record locking, error-checking-all these things should be done before the connection to the server kicks in.

Databases

Database functions are traditionally processor-intensive. Everyone needs them, for anything from orders and inventory control to holding employee information. The benefit of placing database operations in a distributed environment is that while the data exchange operations may take up a significant portion of the server's time, formatting the results is taken care of "offline," without tying up the server resources. As an example, let's consider a CGI program performing database operations.

First, there's the client side. A simple form or alternate interface provides data entry. No error-checking, no real interaction, just type and click. When the user submits the form, data is sent to the server where the server needs to start a process to handle the CGI program, barring the use of in-process server extensions for handling the request. The CGI program then decodes the URL-encoded information and generates something that functions as the calling convention for the database. Next, something needs to initiate a connection to the database, execute the data query, store the results, process the results, process output to match those results to the displayable needs of the client, encode the output, and send it back to the client. The client then loads the new HTML page and displays the static results. It works, and it's definitely a useful function, but there are a couple extra steps there.

With a VBScript and ActiveX solution, the client side takes care of all formatting and error-checking. Pass back a stream of database information, and let the client deal with it. Forgot an entry? Don't ever let the connection to the database open until everything is ready to go. Need more efficiency? Communicate directly with the database or its own special server, and bypass the need for an HTTP server as a middleman. It's not a matter of any less work being done, but rather the location and the efficiency of the work that makes the difference.

Even better, think of what you can do with the results. CGI returns come back as a standard text stream, with the

possibility of some images and other content. ActiveX and VBScript could handle a streamed pile of data and fill dynamic listboxes or other UI features so that you can modify what you get, and send it back. Tried modifying a typical HTML page as the end user lately? Good luck. Taking tables of data, listboxes, and even images, you could modify them and then stream them back to the database. One-stop shopping for your database needs.

TIP

Open database connectivity (ODBC) over the Internet is a growing field. Companies have announced drivers and utilities that allow direct database connections through built-in drivers so that the database server is also the TCP/IP server for database requests. Large database vendors including Oracle, Sybase, and Informix are heavily involved in making all of this a reality, and you can expect to see ActiveX playing a big part in their strategy and in the strategies of people riding their coattails. If you're interested in a direct Internet-capable driver for your database, check with your database vendor to see what they have available. The results may surprise you.

Functionality and Flexibility

There's more possibility for functionality in ActiveX and VBScript combinations than you can easily shake a big stick at. The list of ActiveX controls grows by dozens a day, and that's a bare minimum. OLE and extension controls (like VBXs) have been made by thousands of individual software companies for C and Visual Basic, and the opening of a whole new marketplace has inspired them to new levels of productivity. Chances are quite good that no matter what type of ActiveX control you need, you can either find it already, find something close, or find the instructions to build it yourself. There are certain areas of functionality, however, that transcend specific controls, and fall into general categories of use to the intranet frame of mind. Let's look at a few.

Native Document Hosting

Have a lot of people creating material, but not a great way to convert it into HTML or some other arbitrary format? ActiveX is about to become your best friend. The whole concept behind OCX (and thus ActiveX) controls is to provide a generic container to which additional functionality can be added. The most obvious use of a generic container is to toss in different forms of content.

As an example, someone in your department has created a PowerPoint presentation. Now you'd like to share that with the rest of the company. You can either start taking screen captures and converting to HTML and JPEGs or GIFs, or you can take the easy and more functional way out. Not a tough decision. Microsoft came out with an ActiveX-enabled PowerPoint player, which allows you to embed the ActiveX player object in the HTML code, and reference a filename for the presentation itself. Suddenly, everyone who uses PowerPoint can place his or her presentations up for general use, with no conversion, no mess, no fuss!

The same holds true with other information types. Previously, the network involved hunting down the file you wanted, then hunting down the utility you need to open the document with. Now information is menued and organized, with logical text and links allowing information managers and employees in general to devise navigation that will lead people to relevant information without the hunt-and-peck of a flat file system.

Component Architecture

New functions are just an .OCX file away. Because ActiveX is an open software component environment, any new capabilities that you need can be built in quickly, efficiently, and painlessly. Each new function is capable of cooperation with existing components as well, so that a database program doesn't have to be a reporting software, and a slide show

presenter doesn't have to understand HTML. Everything plugs together to form a seamless whole.

Third-Party Innovation

You don't have to think of everything. How are people supposed to sell you ideas and products if you've thought of, and implemented, everything you could possibly ever need? The number of developers out there who are creating ActiveX components is staggering. Pick up a copy of any magazine dedicated to Visual Basic, flip to the advertisements in the back, and you'll get some idea of what kind of industry already exists for add-on components. Because VBXs (the addons for Visual Basic) aren't too far away from ActiveX controls, the vast majority of these developers will be moving in that direction just as soon as they smell the money. And the smell is getting stronger by the day.

NOTE

Using ActiveX functions on your intranet may be initially limited by the platforms that comprise your network. ActiveX on UNIX, for example, wouldn't have been the best option in the first few months after ActiveX's release. At the time of this writing, in fact, going to UNIX was not even a possibility, though it was being hyped heavily as a future development. Macintosh was the first scheduled platform besides the native Windows implementations, and even that hadn't come to fruition by October. Rest assured, though, that Microsoft realizes that they'll lose a significant chunk of potential revenue if they only cater to Windows, and they'll do everything in their capabilities to make sure platforms aren't a problem.

Return on Investment (ROI)

"But what do we get back, financially?" It's a question heard all the time in companies big and small. Look at what you get so far-less wear and tear on the server, less maintenance, better performance, more functionality, and more expandability. Do these add up to big savings? You'd better believe it. And all of these contribute to two other significant improvements-employee efficiency and company image. Let's look at all of the fiscally friendly components.

Maintenance

We're not talking about cleaning the hard drive, or replacing monitors. Maintaining a corporate information system is all about keeping information up-to-date and accessible under any conditions. Fault-tolerant, mission-critical access is the kind of talk that people in high places like to hear. Maybe it's because they've been reading "Dilbert" and picked up some buzzwords, or maybe it's because they actually need those things; the jury's still out on that. Regardless of the real or perceived need, maintaining an information system comprised of data in a non-native format is time-consuming. Finding out about, getting hold of, converting, error-checking, and approving data before it goes anywhere is taking two steps forward and one step back every time you move. By allowing departments to leave documents in their native format, and using in-place document embedding through ActiveX controls or plain old OLE, responsibility for content can be narrowed down to two things: the accuracy of the original data, and the relocation of the data to the shared area. So, if there's a typo on line 3005 of this year's budget, let accounting fix it. If the new product schematic is missing a power cord, let R&D figure out where to put it and then have them modify the schematic. Isn't delegated responsibility great?

Reduced maintenance equals reduced costs, plain and simple. Less time lost from other revenue-generating projects, less time spent moaning and whining about not being able to get things converted properly, and fewer mistakes due to the conversion or modification by someone outside the originating department.

Expansibility and Integration

MIS Nightmare #23. You research, plan, design, recommend, specify, and purchase a state-of-the-art system that meets