ARexx is the Amiga version of scripting language REXX by IBM. It is not a version licensed from IBM, but is a version written by Bill Hawes who ported REXX to the Amiga, with many special Amiga features.
Technically speaking ARexx is an interpreted language for scripting. This means it should be already active in memory in order to "interpret and run" any program loaded by the users.
A program written in this language (called either a "script" or a "macro") could be applied to expand features and functionality of an Operating System or also to increase the features and capabilities of a productivity program (an application).
Because of its ease of use ARexx is strongly recommended for learning fundamental programming techniques. Because of its simplicity ARexx also has a place in the hearts of experienced programmers because many use ARexx due to its flexibility and integration with the AmigaOS.
End users of a productivity program also find in ARexx a valuable tool which can help them in personalizing their work environment.
ARexx is also useful in exchanging data and files between programs in order to take advantage of features that are present in one application and absent in another, or even to "borrow" a feature from a program while using another one.
Finally, the end user could also benefit of the capability of ARexx to build automated macros to perform scheduled work even in his or her absence and to avoid repetitive procedures.
Almost any modern Amiga program has currently an ARexx port and could exchange data with other programs or use ARexx to automate its internal functions and procedures. Even the Workbench graphical user interface (GUI) of Amiga shares an ARexx port, and the commands of AmigaDOS have a strong compatibility with ARexx.
Development of ARexx has stopped because ARexx is written in 680x0 Assembly and must be rewritten in order to function properly with new PPC CPUs. Also William Hawes is no longer involved in development of Amiga programs because of quarrels in the past with Commodore, Inc. about the licensing of ARexx. Further, there is no Amiga-related firm interested in financing new versions of ARexx. Notwithstanding this fact the existing version of ARexx performs flawlessly and has no major bugs, so no one has yet upgraded it.
More recently Amiga programmers and users have had good experiences with Python programming language. Python is increasingly catching the interest of the Amiga community and is one of the major candidates in succeeding ARexx as integrated language for scripting and expanding the functions of the AmigaOS environment.
ARexx can increase the power of a computer by combining the capabilities of various programs. Because of the wide acceptance of ARexx, Commodore includes it with Version 2.0 of AmigaDOS. If you are an Amiga programmer who is developing an application, it is highly recommended that you provide ARexx compatibility, if appropriate, by inserting an ARexx port in your program.
ARexx uses "typeless" data representation. Other programming languages made distinctions between integers, floating point numbers, strings, characters, vectors, et cetera. In contrast, ARexx deals with all data as strings of characters, making it simpler to write expressions and algorithms. It is not necessary to declare a variable before using it. This feature is typical in a large number of interpreted languages, i.e., the languages in which dynamic data (data that exist during program execution) is handled directly by the interpreter.
Being an interpreted language ARexx has no necessity of any complicated compiler, linker, debugger or development environment. It has a very simple internal mechanism of execution "step by step" of its programs, so anyone could control how execution is performed and correct errors right on the fly. This feature is very useful to increase speed of development of any program and is invaluable for any non experienced user.
All ARexx scripts have to deal with a very complete and sophisticated error handling system which is monitoring any error that could occur during execution. The user could choose in any situation to suspend and resume the execution of the program.
ARexx interpreter gives to the user a simple but powerful system to handle resources. It frees the memory allocated for the variables when an ARexx program ends its execution, it closes open files and the libraries that the program used, et cetera.
ARexx is an imperative language, i.e., it is based on the execution of instructions in a sequence. It is oriented to structured, procedural, and modular programming. The ARexx command set is poor, but in addition to the commands there are the functions of its Amiga reference library (rexxsyslib.library). It is also very simple to add other libraries to ARexx base library or add any new function that could help the programmer. ARexx scripts can also be invoked as functions from other ARexx scripts.
Any Amiga program which has an ARexx port built in can be used by ARexx to pick any function, procedure, or feature and share it with ARexx scripts. This means that ARexx deals with any program which has an ARexx port built into as an entire new set of available commands.
Finally, ARexx has been built to integrate with the Amiga OS system in order to deal at its best with Amiga preemptive multitasking capabilities.
If end user is using a program which build animations joining various bitmap image files but has not image processing capabilities, then he could write an ARexx script which performs these actions:
ARexx locates files in their directory/directories -> ARexx loads first image -> it loads paint program -> image is loaded into paint program which performs modifications to file -> modified image is stored into another directory -> ARexx repeats procedure on any image in the directory -> paint program is closed and animation program is loaded -> animation is built -> animation is saved in its directory -> animation program is closed -> user could be prompted that job is finished -> end of ARexx script
Example 2: Avoiding repetitive procedures
EqFiles.rexx V2.2 is a common example of a simple ARexx script written by an experienced Amiga user who wants to automate repetitive and boring procedures and has enough skills and knowledge of AmigaOS to write such an ARexx program. This REXX script uses another program present in aminet repository ALeXcompare which compares files. EqFiles finds all duplicates in any set of files and returns output by highlighting any results in a different color.
Example 3: Expand AmigaOS capabilities
One of the main features of ARexx is the fact it could expand the capabilities of an OS (AmigaOS) by adding some procedures the OS lacked. For example a simple ARexx program could be written to print a warning message on the screen of the monitor, or play an audio alert signal if a certain Amiga program stops, faults or has finished its scheduled job.
Here follows an example of the structure of a very minimal ARexx script (not correct or debugged and with no arguments and no calls to AmigaDOS) which should print on the monitor screen some alarm warnings depending on an event that could take place or not.
Alarm.rexx
/* Alarm.rexx */
ARG event
IF event = 0 THEN EXIT
IF event = 1 THEN SAY "Program has ended unexpectedly"
IF event = 2 THEN SAY "Program has finished its job"
IF event = 3 THEN SAY "Cannot find data in selected directory"
Example 4: Parse data
ARexx can very powerfully be used to parse data and transfer data between a program and another. Because of its internal "typeless" data representation ARexx could be used (for example) to retrieve data from a database file, read any record, avoid internal marks and special characters and send only valid data to a spreadsheet application putting any single invoice of the database in a single cell.
The author of this script is Professor Fulvio Peruggi who wrote this ARexx script to share his knowledge with the whole Amiga community, so he published it on Aminet internet Amiga repository. He is a well known experienced user in both the Amiga and MorphOS communities. He is also author of various articles regarding Amiga and MorphOS.
ALeXcompare was written by the programmer Alex Kazik
Computer languages | Amiga software