Visual Basic The Visual Basic language version of the example script displays a window when it is run. In this window, the user can select a source and a destination folder from two directory list boxes and start the downsampling process by pressing a button. To view the Visual Basic language example script, start your Visual Basic application and open the VB project file from: ExampleScripts\Down- sample\VB\dwnsmpl.vbp. To see the user interface, select the MainWin form of the project and choose Object from the View menu. To see the scripting code that is executed, choose Code from the View menu. The following sections describe how this script was created. Setting up the project and laying out the user interface The project is a Standard EXE project called “dwnsmpl.” It contains one form with the name MainWin and caption “Downsample.” Added to the form are two frames named SrcFrm and DstFrm. Their captions are “Source” and “Destination” respectively. These frames group together the user interface elements related to choosing the source and destination folders. To pick these folders, a drive list box and a directory list box are needed for each of them. These list boxes are called SrcDrv and SrcDir for the source and DstDrv and DstDir for the destination folder. The form also contains a command button that starts the process of downsampling the images. The name of the button is SampleBtn and its caption is “Down- sample”. Scripting can perform complex functions without your personal supervision. Here we have created a script that will automatically convert high resolution images to a lower, web-friendly resolution. Next, it will then rename and save the resulting files in a different directory. High Resolution Images Low Resolution Images
Canvas 8 Help: Writing Scripts for Canvas (5 of 16)                                                 Page #747