Copyright (c) Hyperion Entertainment and contributors.
AmigaOS Manual: Python Interprocess communication through ARexx ports
Interprocess communication (or IPC for short) refers to a computer's ability to allow the exchange of information between currently running programs.
Contents
- 1 Interprocess Communication and Ports
- 2 ARexx Hosts
- 2.1 Workbench
- 2.1.1 Commands
- 2.1.1.1 ACTIVATEWINDOW
- 2.1.1.2 CHANGEWINDOW
- 2.1.1.3 DELETE
- 2.1.1.4 FAULT
- 2.1.1.5 GETATTR
- 2.1.1.6 HELP
- 2.1.1.7 ICON
- 2.1.1.8 INFO
- 2.1.1.9 KEYBOARD
- 2.1.1.10 LOCKGUI
- 2.1.1.11 MENU
- 2.1.1.12 MOVEWINDOW
- 2.1.1.13 NEWDRAWER
- 2.1.1.14 RENAME
- 2.1.1.15 RX
- 2.1.1.16 SIZEWINDOW
- 2.1.1.17 UNLOCKGUI
- 2.1.1.18 UNZOOMWINDOW
- 2.1.1.19 VIEW
- 2.1.1.20 WINDOW
- 2.1.1.21 WINDOWTOBACK
- 2.1.1.22 WINDOWTOFRONT
- 2.1.1.23 ZOOMWINDOW
- 2.1.1 Commands
- 2.1 Workbench
Interprocess Communication and Ports
Interprocess communication occurs through message ports attached to each program. A message port is an address contained in an application that can receive and send messages. A message send to an application from a Python script will be directed by the Amiga operating system to the application's message port. A message send from an application to a Python script occurs in a like manner.
Each message port has a name (usually the name of the program in capital letters), and sending a message requires the use of the port's name in a Python script. The order of operations in the sending and receiving of a message is briefly described below:
- An application opens a message port
- The application waits to receive a message
- The Amiga lets the application know that a message has arrived
- The application acts on the message
- The application lets the message's sender know that the message has been received and processed
These five steps are critical in interprocess communication, especially the final step of letting the sender know that the message has been received and processed.
ARexx Hosts
Workbench
Workbench is Amiga's default graphical user interface which opens up when Amiga is booted. Through Workbench you can launch applications and manage files and disks using the mouse. Workbench acts as an ARexx host under the name of WORKBENCH which will allow scripts to command Workbench just as users do.
In order to send commands to Workbench from a Python script, the arexx module must be imported first. The module contains the necessary functions to interface with an ARexx host. The module can be imported as follows:
# Include arexx module import arexx
After importing the module, commands can be send to Workbench using the dorexx method:
rc1, rc2, result = arexx.dorexx( 'WORKBENCH', 'MENU WINDOW ROOT INVOKE WORKBENCH.ABOUT')
In the example above, Workbench's about requester will be opened by sending a command MENU WINDOW ROOT INVOKE WORKBENCH.ABOUT to Workbench.
Commands
Workbench responds to the commands listed below.