Tip works in Photo>Graphics Pro only (and regular Photo>Graphics with a bit of effort)
Don't panic if you're not a REXX programmer! You don't actually have to know (or touch a single line of) REXX to still get something out of this column (you can just download the script and use it like a plug-in), although you may be surprised at how easy it is to tweak one a little bit to your liking.
While playing around with the scripting abilities of Photo>Graphics Pro I came up with a simple looking but hard-to-reproduce effect. I was trying to make something along the lines of a regular, Plain-Jane Beveled Edge©, but ended up with something that resembled more of a glassy cut out instead. Now while it looked nice, it was a pain to keep reproducing in Photo>Graphics since it used a lot of custom regions to get just right. I could imagine where I'd want to use this effect in other projects, but messing around with all the steps would be overkill.
It was also around that time that I was trying to learn P>G Pro's REXX scripting interface. With the API they supply, it's possible to run a REXX script inside of Photo>Graphics that can create and modify objects in your workspace. This can be used to make both simple and outrageously complex 'Plug-in' effects. It's harder to master, but fantastically more flexible than, say, the "Graphics States" of ColorWorks. It also has a much lower barrier to entry than conventional, compiled plug-ins that are written in C or C++ since REXX is simple, easy to learn, and comes with OS/2.
Okay, let's start with our effect. While the effect itself isn't all that great, the fact that we can automate the 8-step procedure is. And that's really what this column is trying to do -- get you to see the power of REXX and maybe encourage you to try playing with it yourself.
The script operates on the currently selected object, which can be of any region and effect combination you like. In the example above I just used Headline text with a solid color. From there it performs the following operations: (Remember that you don't have to follow or memorize these steps if you don't want to, you can just download the script and try it out.)
As you can see, 8 steps is a lot. But when compiled into a REXX script it turns into nothing much more than one step that comprises of maybe three or four mouse clicks (Select object, press Ctrl-Z, select the script and click 'Run')
Okay? Seen enough? Then download the script into your X:/PGPro/Scripts directory (where 'X:' is the drive you installed Photo>Graphics Pro to.) If you'd like to examine an example of a .GDO file created with the plug-in, download the GDO file (ZIP, 4.3k).
If you're inclined to dabble, open up the glass.cwx file and browse through it. I've documented each step with a comment, so that combined with P>G Pro's on-line reference should help you make sense of it easily.
As for how I learned? I cheated (sort of) by opening up the regshad.cwx sample script included with P>G Pro and slowly tweaking, experimenting, looking up and guessing until I had what I wanted. Surprise, surprise, it's actually a good way to learn (if you're not some kind of purist ;-)
Don't be afraid to use the editor window in Photo>Graphics itself either. It's bare-bones and doesn't offer nearly half the features as a full-blown REXX editor, but it conveniently stays on top of the other windows while you play with and move objects around. Plus it lets you run the script with a single click of a button.
In future columns I'll talk more about using scripting languages to automate repetitive and laborious tasks. No less than three full-blown graphics packages for OS/2 can be scriptable. These include Photo>Graphics Pro and Impos/2, which both use REXX, and SX Paint which has its own macro language.
By the way, if you've written any of your own REXX plug-ins, I'd love to hear about em! Send them to firstname.lastname@example.org so I may feature them here.
If you're a user of Embellish 2.0 or 2.01 then you'll be pleased to know dadaware has released the upgrade to 2.02. This new version adds a .GIF animator and several bug fixes -- including a fix for that annoying 32-character limit in the Image Map editor and directory shortcuts.
Modular Dreams Inc. have also shipped SX Paint II. While we don't yet know everything that's new in this release, we hope to have more about it for you to read by next month.
Chris Wenham is a freelance web designer, writer and Englishman who now lives in Endicott, NY. In the past he has written comedy, sci-fi, Pascal, REXX, HTML and Gibberish. He has been using OS/2 exclusively for the past 2 years.
|Copyright © 1997 - Falcon Networking||ISSN 1203-5696|