Page 1 of 1

RunRev a good tool?

Posted: Mon Oct 03, 2011 6:54 pm
by Vance
Hello forum!

I have a couple of questions about whether RunRev is a good fit for my project. I would like to build a windows/mac (possibly linux) app that interacts heavily with Microsoft Word and Wordperfect (or Pages on the Mac) with a lot of text manipulation. On the mac, I'd use Applescript a lot, and VBScript, I guess. Architechturally, I think I'd have some objects that handle communication with these applications and then process the text. I also would like to run some iOS and android stuff based on the documents.

My questions are: How good is Revolution at managing text processing? As well as interprocess communication? Can Revolutions scripts have Python or Python libraries (because Python works really well with text)? I believe I saw where you can call Python scripts; can this be done in standalone apps and the Python runtime is bundled with Rev, or would I have to rely on OS support? Not a problem on OS X, but I don't think Windows is nearly as capable out of the box in that department.

Second: How about building gui's programmatically, or dynamic? I.E. can you build a stack that will read a file and generate input forms based on that file? So the buttons, et. al are guaranteed to fluctuate depending on one card or another? Then, of course, reading the data and passing it on to the text side? This is the part that needs to be on the mobile platforms as well. I know I can't send Applescript or what have you on Android or iOS, and that's okay, but the dynamic forms and text processing needs to be available. I was wondering if maybe just using an html form based approach and embedding webkit might be the way to go for that? Can you hide/gray out elements of HTML dynamically?

Third, I'm a traditional programmer kind of guy--I like PHP, Pascal, obj-c; classes, etc. I know that OOP is not really a strength of Revolution; but can you do a fair amount of code separation and encapsulation? I don't want to have have code scattered all over the place; all my text processing should be done in one place, with gui in another and interprocess communication elsewhere, for maintenance reasons and others. Is Revolution a good fit?

Forth: since a large portion of my app won't involve the GUI at all, and I like TextMate and TextWrangler: do you have to use the Revolution IDE for everything or is there a way to use other tools?

Thanks so much for your help!

I like the write once/run (mostly) anywhere idea of this; I just don't know if it is possible.

Vance

Re: RunRev a good tool?

Posted: Wed Oct 05, 2011 12:09 pm
by Mark
Hi Vance,

Whenever I start a new project that should run on Windows, Mac and Linux, my first thought is that I should look into the feature set of LiveCode. LiveCode is definitely worth looking into when you consider doing a cross-platform project. However, there are many features that work slightly differently on each platform and there are also features that work on one platform but not at all on another.

Revolution is very good at text manipulation, if the text can be encoded as Windows Latin or Mac Roman (basically ASCII). Commands like put, get and repeat for each, chunk expressions and the use of variables will let you write scripts to do very complicated tasks quickly and easily. If you are dealing with Eastern European, Chinese, Arabic, Japanese or Hebrew text for example, you might run into trouble and you may with that you had chosen a different programming tool, depending on your requirements.

You can do interprocess communications, but most software won't do this by default and you will have to find workarounds on each platform. On Windows this may be VBScript, on Mac AppleScript, while on Linux you might need to write an external or command line utility. Sometimes it is possible to use sockets for communication between processes.

Scripts can't embed Python libraries. You can't do something like "#import Python.py". If Python is installed, then you can run Python scripts from the shell and return the result to your LiveCode script. You can include files with your standalone, including compiled Python scripts. If you have compiled your Python script as binary executable, then you should be able to call it from the shell, just like any other command line utility, without having Python installed.

You can build a GUI dynamically. You can add and remove fields and buttons and all other objects. However, in a standalone, you can't set a script if it is longer than 10 lines. Sometimes, I solve this by creating a number of template objects and copying them to my GUI as needed. Such objects can have properties, which may alter their behaviour, making the script partly dynamic. Properties can be changed without limits.

Of course you can read all kinds of data and manipulate and display it. All basic features are available cross-platform, such as the get and put commands, if-then-else statements, repeat loops, reading and writing files, getting URL's etc. These features work the same everywhere, including iOS and Android. You can still copy and delete or show and hide objects on mobile platforms and change their properties. The 10-line script limit is the same on mobile.

You can use a browser object to display an HTML form. If you are good at JavaScript, then you can change the form dynamically. Communication between LivCode scripts and browser objects is limited, but you can still achieve a lot with clever scripting.

LiveCode does OOP behind the scenes, just like any other modern programme. I consider it a big advantage that I don't need to write code to create and delete my objects. I can create new instances of buttons, fields, arrays, properties etc. without coding them. That saves a lot of time. Probably, this isn't what you want to know. You want to know whether you can make re-usable templates and libraries. Yes, you can, in several ways. You can create stacks and objects that contain scripts and you can use commands like start using, insert into back, insert into front and properties like behaviors or parentScripts to write a script once and use it everywhere in your project. Behaviors and parent scripts allow you to use one script for many objects. Clever use of properties may affect the actual behavior of the script,while keeping the script itself equal for all objects.

When you become an experienced LiveCode programmer, you will find out that it is often useful to have scripts inside the objects that execute them, while it is sometimes useful to keep libraries of scripts and call these scripts from the several objects. You should not try to transfer your programming style from ObjectiveC to LiveCode, because you will get extremely frustrated. if you develop your own new style, you will come to appreciate LiveCode's flexibility.

I would use the LiveCode IDE for everything. If you start using alternative tools, they will break at some point.

Kind regards,

Mark