Article Preview
Buy Now
FEATURE
Command-Line RBScript
REALbasic's not just for applications anymore
Issue: 3.1 (September/October 2004)
Author: Joe Strout
Author Bio: Joe Strout's favorite language was Python before discovering REALbasic. He feels very conflicted about being the first author to sneak some Python code into
Article Description: No description available.
Article Length (in bytes): 16,805
Starting Page Number: 24
Article Number: 3111
Resource File(s):
3111.zip Updated: 2013-03-10 14:36:48
Related Link(s): None
Excerpt of article text...
REALbasic 5.5 can compile "console" applications, which are command-line tools you run from a console (such as Terminal). This opens up whole new ways of using REALbasic, such as creating web applications (CGIs) or integrating with existing command-line tool chains.
However, REALbasic shares these opportunities with older languages, including scripting languages such as Perl and Python. For anyone used to working in those languages, there's still something missing from the REALbasic tool set. You can create a Python script as a simple text file, set the executable bit on it, and then simply invoke it from the command line (or web page, or whatever). There is no compiling and no building; the operating system simply treats the text file like a program and runs it. Why can't you do the same thing in REALbasic?
As it turns out, you can. This article will show you how.
To follow along, you'll need at least REALbasic version 5.5.2 (a free update for 5.5 users). Earlier versions of 5.5 contained a bug that would interfere with the techniques shown. You'll also need an OS X or Linux environment. My examples will be done in OS X, but should work pretty much the same way in Linux as well.
...End of Excerpt. Please purchase the magazine to read the full article.
Errata (2004-09-15)
The final paragraph of this article was accidentally omitted in the print edition of issue 3.1 (this was corrected for the PDF edition). The article is listed as continuing, but it does not. Here is the full text of that paragraph as it should have appeared on page 26:
Building a command-line RBScript engine opens up new doors to the REALbasic programmer -- doors that were previously open only to speakers of other languages. Even for those who know another command-line language, switching back and forth can be a nuisance. So I'm excited about how this technique may increase the reach of your expertise. Have fun, and let me know how it goes!