Creating a Script for Document Export
The following script writes classified images to subdirectories in the export directory. Each subdirectory holds documents from one class only; the subdirectory name corresponds to the class name. To create the script, complete the following steps.
- In Designer, switch to Definition Mode.
-
On the toolbar, click
Show/hide script
.
- In the Script View for Project dialog box, from the Object list, select ScriptModule.
-
From the
Proc list, select
ExportDocument.
Note: This generates the outline of a subroutine.
-
Add the following code.
Dim sNewPath as String Dim MyImage as SCBCroImage Dim NewFileName as String sNewPath=ExportPath & "\" & pWorkdoc.DocClassName 'Set directory name Set MyImage=pWorkdoc.Image(0) 'Access the image file to the current WorkDoc On Error GoTo Skip 'Skip next step if directory exists MkDir sNewPath 'Create directory Skip: NewFileName=Mid(MyImage.Filename, InStrRev(MyImage.Filename,"\")) 'Set file name MyImage.SaveFile sNewPath & NewFileName 'Save file to directory
- Close the dialog box.
- Switch to Runtime Mode and test the script.