If (args.Count = 2) Then srcDir = args.Item(0) dstDir = args.Item(1) If (VarType(srcDir) = vbString And VarType(dstDir) = vbString) Then ... End If End If As explained for the Visual Basic version of the Downsample script, Canvas is started when a Canvas Application object is created. The CreateObject function is used in VBScript for cre- ating objects. The type of the object is passed as a string parameter. Set cvApp = CreateObject("Canvas.Applica- tion") Now, you create a new illustration document in Canvas. This is exactly the same as in the VB example. Set doc = cvApp.Documents.Add(cvsIllustra- tionDocument) For operations on files and folders, we have to create a FileSys- temObject object and use its GetFolder method to access the files in the source directory. Each of the files is examined to see if it is a JPEG file. The test condition for JPEG files is a “.JPG” exten- sion. If the file name contains a “.JPG” substring, then we assume it is a JPEG file. Set fso = CreateObject("Scripting.FileSys- temObject") For Each srcFile In fso.Get- Folder(srcDir).Files If (InStr(UCase(srcFile.Name), ".JPG")) Then ... End If Next
Canvas 8 Help: Writing Scripts for Canvas (12 of 16)                                                Page #754