Design Automation - Changing Scripts

[Colour Management]
[Free Stock Photos]
[InDesign CS2]
[QuarkXPress 6.5]

[Acrobat 7]
[Creative Suite 2]
[Fontographer 4.1]
[FrameMaker 7]
[InDesign CS2]
[PageMaker 7]
[PagePlus 10]
[Publisher 2003]
[QuarkXPress 6.5]
[Ventura 10]

[Colour Management]
[Free Stock Photos]
[CD Authoring]
[Mac/PC History]
[Creative Suite]
[Acrobat Directions]
[Font Formats]
[DTP Tagging ]
[Data-Driven Design]
[Windows XP]
[Paper to PDF]
[Page Imposition]
[eBook / ePaper]
[Removable Storage]
[Understand Halftones]
[XML Revolution]
[PDF Workflows]
[Text Typography]
[Spot Colour]
[Database Publishing]
[Layout Compositing]
[Design Automation]
[Stock Photography]
[Quark v Adobe]
[Asymmetric Grids]
[Commercial Print]
[Colour Print]
[Preparing Print]
[Understanding EPS]
[Layout Grids]
[Beyond CYMK]
[Acrobat v Immedia]
[Postscript 3]

[Acrobat Tutorial]
[PageMaker Tutorial]


[Home / What's New]
[DTP / Publishing]
[Vector Drawing]
[Bitmap / Photo Editing]
[Web Design]
[3D Software]
[All Reviews]
[All Articles / Tutorials]
[Book Search / Shop]
[Site Map / Search]

you can help support the site with a direct donation or by shopping via the following links:


Thank you!



Publishing Scripting Languages

Tom Arah shows you how you to take charge of your publishing programs through their scripting capabilities.

Photoshops Actions palette 

Generally speaking the vast bulk of computer-based publishing is produced using a handful of major packages from an even smaller number of major developers. The range of work being produced, however, is staggeringly wide and no two users' needs are exactly the same. Clearly what is needed is a way of tailoring the off-the-shelf packages to make them more closely match individual requirements. The key players, such as Quark and Adobe, have thought of this and encourage third-party development of their programs via open APIs (application programming interfaces) and SDKs (software development kits). Using the resulting plug-ins and XTensions the power of the underlying program can be developed into entirely new areas to provide picture-framing capabilities in Photoshop, for example, or table-handling in XPress.

This is a big advance, but it only goes so far - after all the average designer is unlikely to be fluent in C++. What is also needed is a more do-it-yourself approach that puts the customising power directly in the hands of the user. The answer for this is scripting. At its most basic this allows the user to boost their efficiency by recording and playing back repeated actions as macros. Strictly speaking the script isn't adding new functionality at all as it is just stringing together existing commands, but in practice this limit isn't absolute. A script that copies and offsets an object, converts it to a bitmap, applies a blur and then sends it to the back of the stack is effectively adding a drop shadow command. With added programming capabilities and interface customisation, the sky's the limit. Using Word's in-built scripting capabilities, for example, I was able to design a comprehensive content-based interface that entirely replaced Word's own to work exactly as I wanted it to.

Time for Action

Such complete user control is the ideal for publishing packages just as it is for Office applications, but you have to start somewhere. The simplest scripting approach is offered by Adobe via its actions technology available from the Actions palette in Photoshop and now also in Illustrator 8. Both programs comes with their own set of sample actions to show what can be done and more are available using the palette menu's Load Actions command. A typical example is Photoshop's "Medium Round Button" action which adds a web-style pseudo-3D button to your image. By clicking on the arrow next to the action name, it's possible to see just what commands and parameters are involved, namely adding a layer, making a circular selection, applying a fill and then an inner bevel layer effect.

Such supplied actions can be useful in their own right, but much more important is the fact that you can create your own. Simply click on the New button at the bottom of the palette, provide a name, hit the Record button, apply a Save command to ensure a backup of your image in case things go wrong, apply the steps of the action once, and then hit the Stop button. To play back your action in future simply select it and then the palette's Play button. The process could hardly be simpler and is genuinely useful particularly for those repetitive jobs, such as preparing images for online use, where the File>Automate>Batch command can be used to apply an action to an entire directory of images.

However there are serious limitations. The first of these is that not all commands can be recorded. Photoshop 5's support is much better than 4's for jobs like magic wand selection, but you're still likely to come across problems. Sometimes these can be worked around by using the palette menu's Insert Menu Item or the new Insert Path command, but one crucial field is completely out of bounds. The Actions palette can't record the actions you take with the painting and retouching tools ruling out the huge area of local editing.

An even more serious limitation is the complete lack of flexibility and intelligence that actions can offer. If you have recorded the Save As command, for example, the filename you gave that time will be used again when you play back the action almost certainly overwriting a file you want to keep. Likewise with the various supplied Button actions, while you can see the size of the button as a parameter of the Set Selection command, there's no way to edit them for your own use.

This lack of an editing capability is frustrating and a huge drawback, but Photoshop does offer some workarounds. You can delete a command permanently with the trash icon or you can temporarily switch it off by clicking the tick-mark next to the command name. More usefully you can re-record the currently selected command with new options by using the palette menu's Record Again. command. Alternatively you can make dialog-based commands modal by clicking on the option box immediately to the left of the command name. When the action is then run, the dialog will appear to accept user input before the action continues. As a last resort, a stop can be inserted complete with a pop-up message to prompt the user to undertake certain tasks before clicking play again to continue the action.

Such workarounds are useful, but clearly not ideal. What is needed is a way of building intelligence directly into the action. At its most basic this means being able to get information out of the system and being able to act on it. When applying an unsharp mask, for example, if you can find out the resolution of the current image you can set the desired radius of the effect automatically. The next step on from this is to add conditional intelligence so that if a filename already exists, for example, a new numbered copy will automatically be created. Finally for those occasions which demand user input, you need to be able to create dedicated dialogs which ask for just the information the script needs to be able to do its job.

PageMaker Scripting

This level of programming control is exactly what Adobe promises with its alternative scripting solution found in PageMaker 6.5. PM Script offers not just commands and command parameters, but hundreds of query commands to find out information which can be stored as variables and processed with the language's expression and function capabilities. By storing the answer returned by the Getnumpages query as a variable, for example, you could easily write a script that went to the last page of publications below a certain length and to the penultimate page in longer publications. By using the in-built programmatic controls, such as If, Loop and Repeat, the flow of the script can also be made conditional so that the page numbering format could be changed automatically depending on the page's position. Finally PM Script's various dialog commands can be used to create custom dialogs to accept and control user input.

A perfect example of the power the new scripting capabilities open up can be accessed from the Plug-in Palettes> Show Scripts command available from PageMaker's Window menu. Double-clicking on the "Resize Group." script with a group of objects selected calls up a dialog in which the user can set the horizontal and vertical scaling parameters and the anchor point. The difference to scaling with the Control palette is that the script will also automatically resize the text in any text block. As one of the design jobs I frequently have to do is to resize adverts to fit different publication dimensions, this feature could be a godsend.

What also makes PM Script different from Photoshop's Actions feature is the ability to edit scripts with the Edit Script. command available from the palette menu. Unfortunately that's the end of the good news as editing the "Resize Group." script is a profoundly depressing experience. The first of no less than 360 lines - "getselectidlisttop >> N,idg,...,...,...,typ,..." - gives a good idea of the language's ease of use. We're not talking intuitive. By the time you hit the line "m22 = kh*(sin(rot[id])*sin(skew[id])/cos(skew[id]) + cos(rot[id]) )" it's difficult to believe the author hasn't accidentally stumbled upon the secret of cold fusion.

To be fair, a lot of the complexity is caused by PageMaker itself with most of the script consisting of awkward workarounds to overcome its host's inherent limitations when it comes to programmability. Finding out whether a text block in the group is connected to a block outside the group, for example, seems to involve going into story edit mode to jump to the ends of a story and then finding and comparing the cursor position. Likewise, the nightmare line quoted above is part of a section designed to overcome the fact that co-ordinates could have been affected by skewing. In short PageMaker was never designed to be controlled programmatically and it shows. The inevitable end result is that when I tried the script on a real advert the effect was catastrophic.

It's pretty clear that, while the potential of advanced programmatic control is undeniable, the PM Script implementation is too complex and the underlying architecture too weak. So what about the creation of simple action-style macros? This is where PM Script really falls down. There is no record capability at all so the only way to produce a script is from scratch. Unfortunately although Adobe does provide an online Language Guide, this has no useful introduction and there are no facilities such as colour coding or debugging tools to make the job easier.

In short it would be hard to devise a worse scripting language, environment and architecture than PM Script as I found out first-hand when producing the PC Pro PageMaker benchmark test. In the end I was able to produce a useful work-out primarily by adapting existing scripts, but compared to producing the Photoshop benchmark the job was a nightmare. If I had to choose between Photoshop's recordable actions and PageMaker's programmable scripts I would choose the actions every time. Of course, though, there is no reason why you shouldn't have the best of both worlds - simplicity and power. That's what Corel attempts to offer with its CorelScript capabilities in its Draw, PhotoPaint and Ventura applications.

The Corel Alternative

The script-based capabilities in Draw are typical. Clicking on the Script and Preset command on the option bar opens up a dedicated Script and Preset Manager docker window. This offers access to hundreds of preset scripts complete with illustrative icon. Double-clicking on an icon, such as the "3D Button" command, applies the script to the currently selected object. All very simple. Even better though is the presence at the bottom of the palette of a Record command. Click on this, record your actions, click on the Stop button and give your script a name and that's it. The new script automatically appears in the docker window, complete with image thumbnail, ready for you to apply.

The big difference to Adobe's Action-based solution is that the script can then be edited using the docker window's Edit Debug. Script command. The big difference to Adobe's PM Script solution is that editing is actually feasible as the CorelScript language is derived from BASIC and so easily intelligible. With a simple drop shadow command created by duplicating and offsetting an object, for example, it would be simple to identify the ".MoveObject" command and change its parameters to reposition the shadow. Likewise with a command that opened documents, it would be simple to set different documents by editing rather than having to re-record from scratch.

While simple results can be achieved quickly and efficiently, CorelScript also offers serious power. As well as application commands, the language offers functions to retrieve information plus a full complement of programming statements and functions to handle that information intelligently. More to the point, the Corel approach is actively helpful. While the PM Script editor is effectively a cut-down Notepad, the CorelScript Editor is a dedicated application in its own right. On top of colour-coding to help make code readable, the program offers comprehensive online help, debugging tools and a graphical dialog designer complete with form controls from drop-down lists to progress indicators. Perhaps most important of all is the more object-based nature of Draw itself which means that far less code must be spent coming up with workarounds for potential problems.

To show exactly what can be done with scripts, Draw provides some advanced examples in its Script directory again available from the docker window. The Drop Shadow script is a typical example which presents the user with a dialog in which they can choose the shadow position, colour and transparency. Of course it will take a lot of effort before the average user will be able to create similar scripts for their own work, but the necessary programming functionality is there waiting. As an added incentive to encourage the creation of generally useful - and so potentially money-making - add-ons, CorelScript even allows scripts to be compiled to EXE or *.CSB binary form which results in faster processing and protected code.

By straddling both the worlds of simple serial macros and intelligent scripting, CorelScript is undoubtedly a huge advance on the Adobe solutions. However it's not the final word. As with Photoshop, not all commands are available for scripting so that I was unable to automate the conversion of a shadow object to a bitmap in Draw. Worse the command is available when scripting in Ventura which opens up the whole problem of incompatibilities between different environments. This is particularly important as one of the major functions of scripting - especially in a publishing setup - is to automate interaction between applications. CorelScript is OLE-automation enabled which helps in such work, but its single object approach is less than ideal.

VBA - The Future?

The biggest limitation of all though is fundamental - CorelScript's command-based nature. This is undoubtedly much more successful in controlling Draw's generally object-based documents than PM Script was at trying to get a grip on the freeform PageMaker, but again it isn't ideal. The final solution is to move away from the command-based interface to an object and property-based approach. This is exactly what Microsoft is doing across the range of its applications, moving Word's in-built scripting language from WordBasic to Word VBA (Visual Basic for Applications) for example. With its recent announcement that it is licencing VBA, Corel has bitten the bullet and decided to follow suit.

The shift for existing CorelScript users will be dramatic but so will be the advantages. VBA's object-based approach gives much tighter control over applications and so much quicker application development with fewer problems and so shorter debugging cycles. The VBA authoring environment meanwhile offers top-of-the-range professional tools including access to a huge range of ActiveX form controls which will result in much richer interfaces. With faster runtime and optional compilation, easy access to the full Windows API and the underlying file system and to third-party DLLs and COMs, the current divide between DIY user scripts and professional plug-ins will largely disappear.

At a stroke the shift to VBA will open all Corel applications to Visual Basic's current 3.2 million developers who will be able to extend the programs' functionality into completely new areas. In particular because VBA is a shared platform, it opens up the possibility of true OLE-automated integration across applications. Data from an Excel spreadsheet could be used to create an appropriate PowerPoint chart that could be brought into Draw for intelligent fine-tuning, converted to bitmap and texturised in Photo-Paint before being placed in a Word report. More to the point this power will be put in the hands of all users not just professional programmers.

It's all a very long way from recording a couple of actions in Photoshop, but there's no doubt that it's the way things are moving. In fact Corel is very much a latecomer to the party. Adobe made a similar commitment to VBA support well over a year before. The results haven't surfaced yet, but when PageMaker 7 or whatever replaces it appears, I'm confidently expecting PM Script to have been quietly put out of everyone's misery. I certainly hope so because the move to VBA is much more than just a different way of knocking up the occasional script. The move to an open object-based and scriptable architecture is the only sure way to bring an application under the complete control of both programmer and end-user alike.

The move to VBA scripting looks an essential requirement for all programs wanting to remain at the cutting edge of computer development. The same can probably be said of the programs' users. The designer of the future still might not need to be fluent in C++, but it looks like a good knowledge of Visual Basic will be invaluable.

Tom Arah

November 1998

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 site and beyond please use the Google and Amazon search boxes below:

Web 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 or (now or next time you feel like shopping) using these links or the 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]
[Reviews/Archive] [Shop]  [Home/What's New]

Copyright 1995-2005, Tom Arah, Please get in contact to let me know what you think about a particular piece or the site in general.