Windows Script Host Bazaar | ||
Introduction
Script
Editors
|
WSH Development ToolsWriting WSH scripts requires just Notepad or an other editor. But there are other tools providing a smarter support for script editing and testing. Script EditorsUsing Notepad for writing scripts is a bit difficult. This editor doesn't support language features nor does it show line numbers to identify faulty lines. Below are a few editors that fits better the requirements for script development. PrimalSCRIPT is a powerful script editor for Windows developed by SAPIEN Technologies, Inc. If youre developing WSH scripts or scripts for different languages, PrimalSCRIPT might be your first choice. It provides a consistent user interface and development environment for several scripting languages. PrimalSCRIPT version 2, is perfectly suited to WSH script development. It supports line numbering (to identify a line in an error dialog box), a type library viewer, and much more. You can edit .wsf files that contain several jobs or script elements. When you select a script element, the editor will show only the elements codethe element definition and attributes are treated as properties. The left pane in Figure 2-7 shows for example the XML elements defined for the loaded .WSF file. PrimalSCRIPT 2 also handles well-formed Extensible Markup Language (XML) documents. Debugging is also simplified in PrimalSCRIPT 2. The program supports in-place debugging for WSH script files, so you can execute .js, .vbs, and .wsf files from the editor window or pass control to the script debugger. Because PrimalSCRIPT 2 supports type libraries, it can incorporate sophisticated editing features. For example, when you enter an object keyword, a ToolTip window shows you the definitions of the objects methods or properties (similar to Microsoft development environments such as Visual Basic for Applications [VBA]). A 30-day evaluation copy of PrimalSCRIPT 2 can be downloaded http://www.sapien.com. Some people are using Visual Interdev or the Microsoft Script Editor shipped with Microsoft Office 2000. Microsoft Script Editor can do nearly a similar job than PrimalSCRIPT, and its free, if you have installed one of the two products mentioned above. Before you can use this editor, you need to do a Registry hack and you have to know how to use the editor. Launch your Registry Editor (Regedit.exe) and search for the Registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ This key contains the settings for the files already supported. Add a DWORD value named vbs and set its value to 28 hexadecimal. Repeat this step and add also the DWORD values for js and wsh. After closing Registry editor, you can try to use Microsoft Script Editor.
After invoking Microsoft Script Editor you are ready to load and edit script files.
To load and view a script file, simply drag it to the edit window (or use the File/Open Files menu). The names of files already loaded are listed in the Project Explorer window. And here a few trick you should know:
Clicking on a line may identify a line number. Then the line number is shown in the status bar. You can use the File/File New menu or you can press Ctrl+Shift+N to invoke the New File dialog box window. (This dialog box contains also two pages allowing you to load existing and recent files.) Within the New property page select a template file and click Open. The editor creates a file using the template. Note that MSE doesn't recognize all objects (for highlighting etc.). Further details may be obtained from my Microsoft Windows Script Host 2.0 Developer's Guide (Microsoft Press USA). See also the knowledge base article http://support.microsoft.com/support/kb/articles/Q249/0/24.asp for further details. A neat Freeware editor that supports syntax highlighting for VBScript files, Bookmarks, Find/Replace and more is offered by Koan s.a.s, a small company located in Italy. The file may be downloaded from www.koala.it/Eng/script.htm. Beside its easy to use approach the most interesting fact is that the program comes as a standalone file of 400 K. So there is no need to install, the editor can be used from a diskette. EditPlus is a 32-bit text editor for Windows, that is distributed as shareware. EditPlus is simple to use and provides a syntax-highlighting feature for HTML, C/C++, Perl, and Java that you extend to support other languages. The best feature of EditPlus is a toolbar button that enables line numbering in the loaded text file. You can download a 30-day evaluation copy of EditPlus from www.editplus.com. EditPad is a small replacement for Notepad that you can use to edit text files in different formats. EditPad supports line numbering from Version 4.4.1, so EditPad can be a useful addition to Windows. You can download EditPad at no charge from www.jgsoft.com. UltraEdit-32 is a powerful editor for Windows 95, Windows 98, Windows NT, and Windows 2000 that is available as shareware. The program supports the editing of text files with different filename extensions (.bat, .ini, .html, and more) and offers several features for script editing, such as color highlighting of keywords. In the code window, you can activate line numbering. You can download a 45-day evaluation copy of UltraEdit-32 from www.ultraedit.com. The site provides links for downloading several versions of UltraEdit. Other editors that you can use for script editing (but which I haven't tried) include CodeMagic, TextPad, and NoteTab. TextPad and NoteTab are shareware editors. NoteTab also comes in a Light version that's freeware. Neither editor supports text color highlighting. You can download TextPad from www.textpad.com and NoteTab from www.notetab.com. DebuggingScript debugging is supported from Microsoft's script debugger. This debugger is shipped as an optional component with Microsoft Windows 2000. The debugger may be also downloaded for free from Microsoft's scripting web site http://msdn.microsoft.com/scripting. Note that there are two versions, one for Microsoft Windows 9x and one for Microsoft Windows NT. The scripting web site contains a few remarks about these two versions and about requirements. If Microsoft Office or Visual Interdev is installed, I recommend to uninstall Microsoft Script Editor. MSE contains its own script debugger that will be invoked automatically, if an error is detected or if a debuggin switch (//X or //D) is recognized. Chapter 2 of my WSH Tutorial (downloadable for free as WSH Tutorial sneak preview) contains a more details about debugging. Ernest Edwards wrote a debugging COM object to avoid testing scripts with msgboxes. The COM object directs its output to a debug viewer (still available for free from www.sysinternals.com). Download the debugger helper (zip-archive) and enjoy. WSH Trust Policy ChangerWindows XP supports a Trust Policy that allows disabeling WSH script execution. The small HTA-tool TrustPolicy.hta provides a user interface (still in German) with the necessary options to set the trust policy. Further InformationA more detailled discussion of script development techniques, debugging and tools may be obtained from my titles:
Copyright
(c) by Günter Born |