• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Using WSF Files

In Chapter 9, “Creating Your Own Scriptable Objects,” I showed you how to create Automation objects by wrapping a script up in a Windows Script Component file. The XML (Extensible Markup Language) formatting that defines a WSC object can also be used to package regular scripts. In this case, the files are given the extension .wsf, so for the remainder of this chapter, I'll call them WSF files. There are several good reasons to put your scripts into WSF files instead of plain-old VBScript, JavaScript, Perlscript, or other plain script files:

  • You can package several distinct but related script programs into one WSF file and then choose which program(s) to run when you launch the script.

  • WSF files help you to process command-line arguments in a consistent way and to provide online help to script users.

  • WSF files can give you automatic access to the symbolic constants associated with external objects so that you don't need to manually define these constant values in your scripts.

  • WSF scripts can refer to subroutines and functions stored in other WSF files. This lets you maintain just one copy of a WSF file that contains all the handy procedures you develop, and you can refer to this library from any number of WSF programs. If you need to change or fix one of the functions, you won't have to edit every file in which it's used.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint