•   Open the Windows Run dialog and type the following line: cscript C:\VBScripts\dwnsmpl.vbs C:\JPEGs C:\ds_JPEGs Writing the script code A major difference between VBScript and Visual Basic is that VBScript does not use types for variables. You can assign any kind of value to a variable. When an operation is performed on that vari- able, the scripting environment checks whether or not the operation is allowed for the kind of data that the variable contains. Another difference of Visual Basic is that type libraries are not acces- sible to VB Scripts. For example, the constant cvsIllustra- tionDocument represents 1 and cvsImage represents 8. VBScripts scripts have to use the pure values that these constants rep- resent. At the beginning of the Downsample script, some constants are defined to make the use of pure values more readable as below. Const cvsIllustrationDocument = 1 Const cvsImage = 8 Const cvsJPEGFormat = 10 The following are some examples of declarations for variables used in the script. Note that none of the declarations specify a type. Dim args Dim srcDir, dstDir, dstPath Dim cvApp Dim doc Dim obj Dim img Dim fso Dim srcFile The next few lines access the arguments passed to the script. In this case, you check to see if exactly two arguments were supplied and if those arguments are strings. To do this, you need to use the first argu- ment as the source directory and the second as the destination direc- tory. Set args = WScript.Arguments
Canvas 8 Help: Writing Scripts for Canvas (11 of 16)                                                Page #753