Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 9.1


Transmogrify Your Text

Converting text files with RBScript

Issue: 9.1 (November/December 2010)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 35,078
Starting Page Number: 26
Article Number: 9107
Resource File(s):

Download Icon 9107project.zip Updated: 2010-11-01 16:57:16

Related Link(s): None

Excerpt of article text...

Years ago one my favorite products was software called OneClick. (It was for Mac OS 9 and sadly never made the transition to Mac OS X.) OneClick was ostensibly macro software that let you automate actions, but it had a powerful scripting language that was similar to REALbasic in many ways. With OneClick you built floating palettes of buttons and you could script what happened when you clicked the buttons. Because OneClick was always running, with your palettes and buttons always available—and editable—it made a terrific environment for doing quick text manipulations. I still miss it and while I love REAL Studio, sometimes it's a pain to have to compile an entire app just to run a few lines of code.

Where this shows up most often for me is in working with text files. I've mentioned before that I love plain text files because of their simplicity and universality, so I use them as data storage for all sorts of projects. But that means I'm often running into situations where I need to do some text manipulation on those files. Sometimes I can use a text editor like BBEdit to do a find/replace, but often I need to do a whole sequence of finds/replacements, or perhaps do some context-sensitive decision-making which is beyond even regular expressions' ability. In those situations I turn to REAL Studio.

While it's not hard to write a drag-and-drop app that lets me do powerful text conversions easily, I've found I keep reinventing the wheel. It's also a hassle to have to fire up REAL Studio and recompile a new version of my app just for a tiny code change. So recently I got smart and created an RBScript-based system that lets me easily create external scripts to do whatever kind of text conversion I need!

How Transmogrify Works

The most significant aspect of Transmogrify is that it never modifies the original file. It always saves changes as a new version of the file. Thus the workflow for Transmogrify is:

Run the app.

...End of Excerpt. Please purchase the magazine to read the full article.