More Alternative Languages for WSH - Object Rexx
(Page 2 of 5 )
Object Rexx is an object-oriented programming language that was originally developed by IBM for its OS/2 and OS/390 line of operating systems. In late 2004, IBM released it as open source, giving rise to the free Open Object Rexx project.
Object Rexx, in its original form from IBM, is not offered for free. There is a fee to download the development environment; however, the client runtime version can be downloaded and installed for free.
This version of Open Object Rexx offers WSH support as well as compatibility for classic Rexx and other Open Object Rexx interpreters. Because Rexx is still quite widely used on IBM servers, it presents the next alternative for use in the Windows Script Host environment.
The Open Object Rexx installer found in the link above will create an .rxs file association for use with WSH. You will not need to supply an engine on the command line.
IBM’s Object Rexx development environment provides a very powerful debugger that is designed to minimize development time. Rexx’s efficiency and sophistication make it extremely popular among some system and network administrators.
fso = .OLEObject~new("Scripting.FileSystemObject")
The most common method of connecting to a COM object uses the OLEObject class. Notice the ~ syntax instead of the object dot syntax you’re probably more accustomed to seeing. Object Rexx also provides a GETOBJECT variation of this statement.
files = fso~GetFolder("C:temp")~Files
Working with Collections
Once again you can see Object Rexx’s unique object syntax as we use the FileSystemObject’s Folder object to return a collection of File objects.
do file over files
say file~name
end
Finally, Object Rexx is able to manipulate collection objects directly so we can create a loop to iterate over each object and print its name.
::requires "orexxole.cls"
In order to use ooRexx to access COM objects, you will need to include the above required line at the end of your script.
Next: KixStart >>
More Windows Scripting Articles
More By Nilpo