Scripting

Scripts are lightweight coding languages used by to extent HTML and various other technologies such as MS Word. Scripts have many applications in Help development, from providing additional user assistance in your Help files to simplifying Help development and maintenance. 

Scripting Languages

Which language you can use to create a script depends on the environment in which the script is to run. Some of the more common script languages used by Help developers are listed below.
  • ECMAScript : ECMAScript is a standardized version of JavaScript formalized by ECMA International. It is identical to JavaScript in most important respects, although some JavaScript features are not included in ECMAScript. : ECMAScript as a language identifier is not supported in most browser versions, so while you can write your scripts following the ECMAScript standard, you'll usually want to identify them as JavaScript.
  • JavaScript : Possibly the most commonly used scripting language today, JavaScript is typically used on Web pages to provide features such as interactive menus, form validation, and popups. It is supported by all of the major browsers (Microsoft Internet Explorer, Netscape, and Opera), along with many others, and it can also be used in Microsoft HTML Help files. You can use it on many Web servers to programmatically determine what HTML source code is sent to Web browsers. : The use of JavaScript is not limited to the Web and HTML, either. Microsoft provides a free Windows Script Host environment that lets you use JavaScript to automate common Windows tasks, like batch files but much more powerful. Even Adobe Acrobat has a JavaScript interface for PDF files.
  • JScript : JScript is Microsoft's name for its implementation of JavaScript. In Internet Explorer and HTML Help, there is no difference between the two, and you can designate a script using either name. Since the JScript identifier is not recognized in other browsers, for cross-browser compatibility you want to identify scripts as JavaScript.
  • VBScript : VBScript is a scripting language based on Microsoft's Visual Basic programming language (which is in turn based on BASIC). It can be used in HTML pages that are viewed with Internet Explorer, but not with other browsers. Like JavaScript, it can also be used on Microsoft Web servers and in Windows Script Host. : VBScript tends to be a little easier for novices to learn because most of the commands are logical English words or abbreviations, but its limitation to Microsoft environments makes it less popular.
  • Visual Basic for Applications (VBA) : Like VBScript, VBA is based on Microsoft's Visual Basic, but it only runs inside applications that support it. Microsoft Office 97 and later use VBA as their macro language. It allows programmatic access to most areas of the application, and can even be used to programmatically communicate between applications. Like Windows Script Host, VBA also allows access to files and the general Windows environment. : Help authors who use Microsoft Word either by itself or in conjunction with a Help Authoring tool can automate many authoring tasks using VBA. Its comprehensiveness makes the possibilities virtually limitless.
  • WinHelp Macros : The WinHelp macro set is a small collection of functions and commands that are specific to WinHelp files.
  • WordBasic : WordBasic was the Microsoft Word macro language for Word 95 and earlier. Although just as powerful as VBA in most respects, it only runs in Microsoft Word.

Scripting In Help Files

Most script you write in uncompressed HTML will usually work equally well in compressed help files such as HTML Help (.CHM). You may need to add the script file to the [FILES] section of your .HHP project file to make sure it gets included in the .CHM file at compile time.


Comments