Screen.MousePointer = vbDefault Next, create a new illustration document in Canvas 8. Remember that Canvas 8 got started at the beginning of the script. A new document can be created by calling the Add method of the Documents collec- tion in the Canvas Application object. To create an illustration document, the parameter of the Add method must be set to cvsIl- lustrationDocument. The result is a reference to the created Document object. You then assign the result to the variable obj of type Canvas.Document for later use. Set doc = cvApp.Document.Add (cvsIllustrationDocument) Now the script has to loop over all of the files that are in the selected source folder. The FileSystemObject object of the Microsoft Scripting Runtime type library provides functionality for file access. Next, you create a FileSystemObject object, loop over the files in the source folder, and store each File object in the srcFile variable. Dim fso As New Scripting.FileSystemObject Dim srcFile As Scripting.File ... For Each srcFile In fso.GetFolder(SrcDir- Path).Files ... Next The GetFolder method of FileSystemObject returns a Folder object for the folder whose path is passed as a String parameter. The For Each loop takes one file after another from the Files collection of the Folder object and assigns that File object to the variable srcFile. Now you need to check whether or not the current file is a JPEG file. This is done in a separate procedure that takes the file name as a parameter, converts it to uppercase, and then checks if the name con- tains the substring “.JPG”. If the file is a JPEG file, then it is placed in the created illustration document. The Place method of the Document object takes the path of the file as a parameter and places it on the currently active layer of that document. The position of the placed file can optionally
Canvas 8 Help: Writing Scripts for Canvas (8 of 16)                                                 Page #750