Appendix C. Sample Rexx Programs

Rexx supplies the following sample programs as .REX files.

CCREPLY.REX

A concurrent programming example.

This program demonstrates how to use reply to run two methods at the same time.

COMPLEX.REX

A complex number class.

This program demonstrates how to create a complex number class using the ::CLASS and ::METHOD directives. An example of subclassing the complex number class (the Vector subclass) is also shown. Finally, the Stringlike class demonstrates the use of a mixin to provide to the complex number class with some string behavior.

DESKICON.REX

A WindowsProgramManager class example.

This sample uses the method AddDesktopIcon of the WindowsProgramManager class to create a shortcut to a program or an application on the Windows desktop.

DESKTOP.REX

This program demonstrates how you could use the WindowsProgramManager class to manipulate program groups and program items.

DRIVES.REX

A sample use of the Sys... functions.

This program displays information about drives using the utility functions SysDriveMap, SysDriveInfo, SysFileSystemType, and SysBootDrive.

EVENTLOG.REX

A sample use of the WindowsEventLog class.

This sample demonstrates how to read from and write to the Windows event log using the methods of the WindowsEventLog class.

FACTOR.REX

A factorial program.

This program demonstrates a way to define a factorial class using the subclass method and the .methods environment symbol.

GREPLY.REX

An example contrasting the GUARDED and UNGUARDED methods.

This program demonstrates the difference between GUARDED and UNGUARDED methods with respect to their use of the object variable pool.

GUESS.REX

An animal guessing game.

This sample creates a simple node class and uses it to create a logic tree. The logic tree is filled in by playing a simple guessing game.

KTGUARD.REX

A GUARD instruction example.

This program demonstrates the use of the START method and the GUARD instruction to control the running of several programs. In this sample, the programs are controlled by one "guarded" variable.

MONTH.REX

An example that displays the days of the month January 1994.

This version demonstrates the use of arrays to replace stems.

OLE\APPS\SAMP01.REX

Starts Internet Explorer and shows the RexxLA homepage. After 10 seconds the RexxLA news page is displayed.

OLE\APPS\SAMP02.REX

Shows some features of the Windows Scripting Host Shell Object:

  • Query environment string

  • List special folders

  • Create a shortcut on the desktop

OLE\APPS\SAMP03.REX

Shows some features of the Windows Scripting Host Network object:

  • Query computer name, user name

  • List network connections for drives and printers

OLE\APPS\SAMP04.REX

Creates a mail message in Lotus Notes® and sends it to a number of recipients automatically.

OLE\APPS\SAMP05.REX

Creates a new document in WordPro 97, enters some text with different attributes, and finally saves and prints the document.

OLE\APPS\SAMP06.REX

Creates a new document in WordPro 97 with a provided Smartmaster. Fills in some "Click here" fields with data prompted by the program or queried from the system. Finally the document is saved to the directory in which this Rexx program is located and is sent to the printer.

OLE\APPS\SAMP07.REX

Creates a new spreadsheet in Lotus 1-2-3® and fills in a table with fictional revenue numbers. The table also contains a calculated field and different styles. A second sheet is added with a 3D chart displaying the revenue data.

OLE\APPS\SAMP08.REX

Creates a Microsoft Word document, enters some text, and saves it. The program then loads the document again and modifies it.

OLE\APPS\SAMP09.REX

Creates a Microsoft Excel sheet, enters some data, and saves it.

OLE\APPS\SAMP10.REX

Uses the Windows Script Host FileSystemObject to obtain information about the drives of the system.

OLE\APPS\SAMP11.REX

Gets the stock price from the RexxLA internet page with Microsoft Internet Explorer, and stores it in a Rexx variable.

OLE\APPS\SAMP12.REX

Demonstrates the use of events with Microsoft Internet Explorer:

  • Navigate to the RexxLA homepage and disallow the changing of the URL to a page not in that "address space".

OLE\APPS\SAMP13.REX

Demonstrates the use of events with Microsoft Internet Explorer:

  • Search for the string "Rexx" on the RexxLA Web page, and go randomly to one of the found sites.

OLE\OLEINFO\OLEINFO.REX

This application is a "small" browser for OLE objects.

OLE\ADSI\ADSI1.REX

Retrieves information about a computer with ADSI.

OLE\ADSI\ADSI2.REX

Gets a user's full name and changes it.

OLE\ADSI\ADSI3.REX

Shows the use of ADSI containers.

OLE\ADSI\ADSI4.REX

Shows the use of filters with ADSI collections.

OLE\ADSI\ADSI5.REX

Displays namespaces and domains.

OLE\ADSI\ADSI6.REX

Enables you to inspect the properties of an object.

OLE\ADSI\ADSI7.REX

Creates a group, and places several users in it.

OLE\ADSI\ADSI8.REX

Removes the users and the group that were created in sample ADSI7.REX.

OLE\METHINFO\MAIN.REX

This application demonstrates the use of the GetKnownMethods method.

OLE\WMI\ACCOUNTS.REX

This is a demo application for displaying all the accounts of the windows system with WMI. It also shows how to display all the properties of a WMI object in general.

OLE\WMI\SERVICES.REX

This application demonstrates how to list, start, stop, pause, or resume windows services with WMI.

OLE\WMI\PROCESS.REX

This application displays by means of WMI the processes of a windows system that are running.

OLE\WMI\OSINFO.REX

This sample script uses a Windows Management Instrumentation (WMI) object ("Win32_OperatingSystem") to obtain information about the installed operating system(s).

OLE\WMI\SYSINFO\SYSINFO.REX

This is a demo application for inspecting some system properties using WMI.

PHILFORK.REX

Sample for concurrency with command line output.

PIPE.REX

A pipeline implementation.

This program demonstrates the use of the ::CLASS and ::METHOD directives to create a simple implementation of a CMS-like pipeline function.

QDATE.REX

An example that types or pushes today's date and moon phase, in English date format.

QTIME.REX

An example that lays or stacks time in English time format, and also chimes.

REGISTRY.REX

This program demonstrates how you could use the WindowsRegistry class to work with the Windows registry.

SEMCLS.REX

An Object Rexx semaphore class.

This file implements a semaphore class in Object Rexx.

STACK.REX

A stack class.

This program demonstrates how to implement a stack class using the ::CLASS and ::METHOD directives. Also included is a short example of the use of a stack.

USECOMP.REX

A simple demonstration of the complex number class.

This program demonstrates the use of the ::REQUIRES directive, using the complex number class included in the samples.

USEPIPE.REX

Sample uses of the pipe implementation in PIPE.REX.

This program demonstrates how you could use the pipes implemented in the pipe sample.