Script Templates

Very often you have to write scripts that function similarly but do slightly different operation. for example, a script that changes all read fills of object in CorelDRAW document for blue fills and a script that sets Scale Outline with Image to all objects would use the same algorithm to run through all the objects. Or a script that prints all CDR files in a given folder and a script that convert all TIFF files to 256-color GIFs using Corel PHOTO-PAINT would use the same function to find all files in a folder and perform application specific operations on them.

This page contains some useful templates that implement basic methods and algorithms you can use when writing your own scripts.

  • Batch File Processor. Find all files in a specified folder matching the mask entered and calls ProcessFile subroutine. The four parameters in call to ProcessFile can be used to load the file and save the processed results:
    File$ is a file name (without path and extension)
    Ext$ - the source file name extension (with the dot)
    Src$ - source path
    Dest$ - destination path
    For example, if you enter "C:\TEMP\*.CDR" and the script finds Pic.cdr in the folder, Process file will be called with the following parameters: File$="Pic", Ext$=".CDR", Src$="C:\TEMP\", Dest$ is whatever you enter in the destination field.
  • Object cycler. Looks for all the objects in the currently open document in CorelDRAW and calls ProcessObject subroutine for each of them. You can put any functionality in this subroutine.

[ Learning CorelSCRIPT | Oberon Home Page ]

Copyright 2000 by Alex Vakulenko. All rights reserved.
This page was last revised on 01/13/00.