[3D Rendering Tutorial]
Automated Database PublishingTom Arah gets to grips with the advanced features of Corel Ventura and finds that after the pain comes gain.
Adobe's recent decision to demote PageMaker in favour of the next generation InDesign has had major repercussions. One of the less spectacular but more personally alarming consequences is that it led Derek Cohen to decide that the PC Pro DTP benchmark needed to be redone from scratch. From my less-than-happy experience with PageMaker's scripting language (see RW53) I wasn't sorry to see the back of it, but which program should take its place? Neither XPress nor FrameMaker offer scripting so weren't contenders, InDesign makes much of its new automation features and VBA support but is as yet unproved and so, almost by default, the choice fell to Corel Ventura.
Simple Corel Scripting
To make sure that the program would be up to the job I gave it a quick work out. This was simplicity itself thanks to Corel Script's first huge advantage over PM Script: its ability to record actions. Hit Ventura's Tools>Corel Script>Start Recording command, work as normal and then click the Stop button on the floating Recording & Script toolbar and that's it. The resulting script can then be saved and run in future using the Run/Manage Scripts dialog. All I had to do was create a new publication, set up a page tag, import some text and graphics, do some find and replacing and reformatting, print to file and that was it. A workable and realistic benchmark and I didn't even have to look at the code.
Unfortunately Derek had other ideas. Corel Ventura's greatest strength lies in its handling of long structured documents and he wanted the benchmark to realistically reflect a real world task. As such he wanted to take a full month's worth of PC Pro reviews and images and convert them into a working paper publication and then to re-purpose the publication for the Web. And it soon became apparent that he wasn't going to be giving a lot of help. The text arrived as a mail-merge file with each of the 20 separate fields in each of the 50 reviews running on from each other in a single line. And to complicate things further each of the referenced graphics was in the Mac-friendly and distinctly PC-unfriendly PICT format!
Clearly it was going to be more work than Plan A, but it shouldn't be impossible. Essentially the task broke down into two parts. First of all I needed to get the text into a usable format and then I needed to set up a system for automatically importing the graphics. To sort out the text, the comma-delimited records had to be converted into pre-tagged paragraphs. Fortunately Ventura comes with a dedicated utility, Corel DataBase Publisher, which is designed for just this sort of task. Unfortunately Ventura's system of embedding formatting information as tags into the text file doesn't extend to embedding image information so to bring in the graphics I'd have to do some real programming with Corel Script. Oh well. Here was my chance to try and master the most advanced database and scripting features in Ventura. It would be a good test for both of us.
I hadn't used DataBase Publisher for real work before, but it's very easy to get to grips with thanks to its simple step-by-step metaphor. The central application is actually a small dialog consisting of just nine options - select a database, set publishing options, select records, sort records, select fields, apply field attributes, apply global attributes, set output options and then process - which walk you through the publishing procedure from start to finish. All the settings that you make are then stored as a RCP recipe file which you can run in future to republish your changed data automatically.
In fact not all the nine steps are obligatory so, as all I was wanting to do was to apply tags to the fields, the process was very straightforward. DataBase Publisher supports delimited text files and allows you to treat the first row of the text file as field titles. It then lets you choose to pre-tag all fields and to automatically set the tag name as the field name. After choosing to output all records and all fields it's then just a question of specifying a text file name and hitting the Process command. The resulting file can then be loaded into WordPad for checking.
First impressions looked good as the tagging process had worked beautifully with each field appearing as a separate paragraph and neatly tagged with Ventura's "@tagname =" system. Closer inspection though was less encouraging with some punctuation replaced by other characters and the main body copy cut to a limit of 255 characters. Much more worrying was the fact that when I tried to load the file into Ventura all I got was an "invalid file format" error. To make matters worse, although Ventura claims to support the PICT format, when I tried to import any of the graphics the program crashed.
Being unable to load either text or graphics isn't a great start and I was tempted to return to Plan A, but pride's a funny thing. Converting the graphics to a readable JPEG format wasn't a problem using the excellent Mijenix PowerDesk and it would just require some extra coding to sort out the resulting broken links. As for the text file, I decided that starting from a text-delimited file was a bit much to ask and so used Access to convert the file into a more advanced database format in this case choosing Corel's own Paradox DB format. This meant that DataBase Publisher recognised the body copy as a memo field and so no longer truncated it on export, but the resulting file still wouldn't load into Ventura. I opened it in Word to explore why and on saving was prompted to specify a character coding. Presumably this had been the problem - a hangover from the file's Mac origins - as the saved version now loaded into Ventura without difficulty.
Now that the text and graphics could be opened it was time to automate the process of bringing them together. Again I began by using Corel Script's recording capabilities but this time there was no way of avoiding getting involved with the code. After recording and saving a simple start-off script I opened this into the dedicated Corel Script Editor program that is shared across all Corel's main applications. Compared to PM Script's sub-Notepad editor this is in a different league with features like colour-coding, debugging tools and a syntax checker. It's not quite up to VBA standard with no Object Browser to show all of an object's available properties and no automatic listing of possible parameters, but while less productive for professionals this means that the environment is much less intimidating for occasional users.
The Ventura version of Corel Script is clearly based on Basic and is command-driven with options, such as .FileNew and .EditCut, largely mimicking Ventura's own. Again this is less powerful than a true object-based system but it is easier to get to grips with and with reasonably detailed online help, it's pretty simple to get up and running. One of the immediate benefits of editing over recording is that it's much easier to handle repeated routines. By copying the recorded code for formatting a title tag, for example, it's easy to change a few parameters and create the code for formatting a subheading. A similar process soon sorted the find and replace routines necessary to convert the missing punctuation back into apostrophes and so on.
So far so good. The real test of CorelScript though would be to see how it handled the automatic import of the relevant images as this moves on from basic macro-style repetition to real programmatic intelligence. The first challenge is to be able to get information back out of Ventura to be able to pick up the image filenames. Without a true object-orientated property-based approach this is less straightforward and powerful than it would be in a VBA application, but Ventura compensates with its wide range of functions. Using these functions it is possible to get feedback on such parameters as the current page, font, tag and so on. Most relevantly, using the .SelectedText () function, it's possible to retrieve text from the publication.
As DataBase Publisher had paragraph-tagged each referenced image it's possible to do a tag-based find to pick up each filename and to store it as a named variable. Using CorelScript's string handling routines it's then a simple job to add the necessary directory name prefix and to drop the ".pict" suffix and replace it with ".jpg". Our variable now points to the right file and it's a simple matter to create a frame and import the desired file into it. By setting up a Do.Loop structure our script finds each example of the "Picture_Path" tag, reads the text, processes it to produce a JPEG filename, adds a frame, imports the right file into it, and then moves on to do the same to each of the referenced images.
Suddenly with functions, string handling, variables and control structures our script has come alive and does something truly useful. But that's only the beginning. We can also exploit some of Ventura's advanced features to create a genuinely impressive application. By recording a Table of Contents routine we can generate a text file that contains a list of all "Title" tags complete with the page number they appear on. Even better, we can make use of the .PublishAsHTML command. This works slightly bizarrely in that it's not possible to set parameters apart from the output filename, but instead it picks up Ventura's current settings. As discussed in the recent article on re-purposing (RW55), Ventura's HTML capabilities are strong and include CSS support and the ability to automatically generate a navigation frame based on index entries or table of contents markers.
The end result is that our script does everything we could have hoped for, taking the pre-tagged text file, formatting it complete with graphics into an attractive paper publication and then re-purposing it as an easily navigable web site. OK it's not exactly going to put the PC Pro designers out of a job but for a technical publication it could be a seriously useful cross-media solution. Even better Corel Script offers a .FileExit command and allows its CSC script files to be compiled as standalone EXE files. In fact by setting the .SetVisible command to False it is possible to run the EXE and produce the printed and web output without ever even seeing that Ventura is involved!
Back to the Drawing Board
This is very serious power and it encouraged me to go back to take another look at DataBase Publisher to see just what more it could offer as a springboard for scripting. Again I was impressed. The database management is advanced with the ability to specify joins to up to 64 secondary tables from your main table along with the ability to set up your own calculated fields. The ability to structure data using heading level fields that are only published when they change is also advanced and allows the creation of directory-style publications, for example listing employee details region by region.
It's the control available under the Field Attributes command though that really surprised me. This is primarily used for setting tag names for fields, but it also offers three further tabs. The first of these, Tables, offers customised control over Ventura's top-of-the-range table formatting. The second, If Missing/Repeating, allows customised handling of null or repeat entries. However it's the third, Dictionaries, that offers the most power. Each customisable dictionary is simply a list of terms and their replacements. Whenever a dictionary is applied to a field, Ventura simply substitutes each occurrence with its replacement when the data is processed. Dictionaries can be used to customise sorting or tagging but their primary use is to replace text, for example, restoring shorthand abbreviations. In our case the obvious use would be to restore those characters that had been wrongfully converted.
The Field Attributes page has another even more impressive trick up its sleeve with its ability to change between field types. In most cases this capability will be used to convert between text, numeric, logical and date fields, but it's also possible to specify that a field refers to a file. You can then specify a directory and if necessary an extension and also set up a frame for the file to be imported into. You can even set a frame tag to control the formatting and positioning of the frame or override this with custom settings.
Such information can't be stored in the output text file so when it comes to processing, DataBase Publisher instead starts up an "automation server" which effectively works as our script did to automate the import procedure. The main difference is that it also anchors frames so that if the layout is redesigned the images can be automatically restored to their rightful place. What's more, by using a field dictionary and converting from ".pict" to ".jpeg", even the necessary string processing in our script can be handled internally from within DataBase Publisher without the need for Corel Script at all.
Cutting out the middleman
In fact DataBase Publisher can not only dispense with Corel Script it can also do without Ventura! By setting your publishing options to HTML you can set up your database for output directly to web pages without going through Ventura at all. When it comes to formatting fields you are presented with a dedicated HTML keypad from where you can choose all the standard HTML tags and embed the most common formatting codes. Alternatively you can choose to output your data in HTML table format or even choose one of three Java-powered interactive views of your data, InstantView, InstantChart or InstantAnalyzer. You can even choose to direct output between <CORELWEBDATA> tags to quickly update existing pages with new data.
Clearly by thinking of DataBase Publisher as a simple tagging utility I was grossly underestimating the power of a program that is more than able to stand alone in its own right. As such, while I'm more than happy that the script I laboured to produce is a useful benchmark, it's actually not an example of a real world task at all. Anyone doing the same job would be much better off using DataBase Publisher to achieve the same goals and they wouldn't have to touch Corel Script at all and they might even be able to bypass Ventura.
Having said this, of course DataBase Publisher doesn't make Ventura or Corel Script redundant. Instead the programs are best seen as an integrated team. For some web jobs loading a DataBase Publisher recipe and hitting Process would be all that was needed. For other print-orientated tasks, or for web output where Ventura's HTML frames and CSS support is an advantage, DataBase Publisher and Ventura would work in tandem. For the most advanced jobs, for example where you wanted to automatically apply captions to images or to rotate frames depending on whether they were on left or right hand pages, then Corel Script's programmability would come into its own.
The one thing that is certain is that after its shaky start, the Corel Ventura suite came through the test with flying colours. Design automation for both print and web is going to be major battleground between the professional DTP applications and for the moment the Corel Ventura/DataBase Publisher/ Script combination leaves the other contenders standing.
Hopefully you've found the information you were looking for. For further information please click here.
For free trials and special offers please click the following recommended links:
For further information on the following design applications and subjects please click on the links below:
[3D], [3ds max], [Adobe], [Acrobat], [Cinema 4D], [Corel], [CorelDRAW], [Creative Suite], [Digital Image], [Dreamweaver], [Director], [Fireworks], [Flash], [FreeHand], [FrameMaker], [FrontPage], [GoLive], [Graphic Design], [HTML/CSS], [Illustrator], [InDesign], [Macromedia], [Macromedia Studio], [Microsoft], [NetObjects Fusion], [PageMaker], [Paint Shop Pro], [Painter], [Photo Editing], [PhotoImpact], [Photoshop], [Photoshop Elements], [Publisher], [QuarkXPress], [Web Design]
To continue your search on the designer-info.com site and beyond please use the Google and Amazon search boxes below:
|designer-info.com: independent, informed, intelligent, incisive, in-depth...|
All the work on the site (over 250 reviews, over 100 articles and tutorials) has been written by me, Tom Arah It's also me who maintains the site, answers your emails etc. The site is very popular and from your feedback I know it's a useful resource - but it takes a lot to keep it up.
You can help keep the site running, independent and free by Bookmarking the site (if you don't you might never find it again), telling others about it and by coming back (new content is added every month). Even better you can make a donation eg $5 the typical cost of just one issue of a print magazine or buy anything via Amazon.com or Amazon.co.uk (now or next time you feel like shopping) using these links or the designer-info.com shop - it's a great way of quickly finding the best buys, it costs you nothing and I gain a small but much-appreciated commission.
Thanks very much, Tom Arah
[DTP/Publishing] [Vector Drawing] [Bitmap/Photo] [Web] [3D]
[Articles/Tutorials] [Reviews/Archive] [Shop] [Home/What's New]