Adding a User Interface to Your RBScript
Issue: 10.4 (May/June 2012)
Author: Marc Zeedar
Article Description: No description available.
Article Length (in bytes): 10,538
Starting Page Number: 65
RBD Number: 10409
project10409.zip Updated: Wednesday, May 2, 2012 at 1:27 AM
Related Link(s): None
Known Limitations: None
Excerpt of article text...
As you probably know, RBScript is one of my favorite features of Real Studio. I have been using it more and more as it really makes my applications so much more powerful. It's a great way to externalize code so I don't have to recompile my entire project just to make a tiny change.
One key limitation of RBScripts is that they don't have a user interface. For many uses of RBScript that's not a problem—the script simply does the processing on data established from the main program. However, what if a script needs to ask the user a question?
I recently decided to enhance my "filename cleaner" app I created as part of my "Scripting for Fun and Profit" article in RSD 7.1. You'll remember that that app is a simple file renamer app that gets its instructions—how it renames—via external RBScripts, making it easy to customize for any need.
When I had a bunch of filenames with the same text in them which I wanted changed, I could have simply written a custom script to make that change. But what about the next time I had a similar situation? I'd have to edit my script every time I wanted to do a "find-replace" type rename. It would work far better if my script could ask for input and allow me, at runtime, to put in the old and new text for the filename.
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.