Download this document and sample script for offline reading (140 kbytes in size).
Do you have any favorite lights you control from your desktop frequently? Don't want to wait until HOUSE/2, HOUSE/290 or the Virtual Keychain remote loads? There is a simple way to solve this problem by creating an object menu in OS/2 Warp. This document will show how to put an X10 Control menu into the desktop pop-up menu and add menu selections to control your lights and appliances using X10 devices and the Comm Engines of HOUSE/2, HOUSE/290 or CM17A (FireCracker). X10 control is then accessible by simply right-clicking on the desktop.
First of all, you must make sure you have either HOUSE/2, HOUSE/290 or CM17A (FireCracker) installed and have the corresponding X10 hardware connected to your computer. Next, edit the script CMDA1ON.CMD (right-click here to save sample script to your disk) to whatever X10 device you want to control. Open CMDA1ON.CMD with a text editor and change the house, device and function code to your module settings. Also, make sure you remark out the corresponding pipename for the Comm Engine you are running. Save the script with a name that reflects the command to perform, i.e. the command A1 ON would be contained inside the script CMDA1ON.CMD. Save a different script for each command you want to execute from an object menu. The sample script is heavily commented and once you open it with a text editor, all should become obvious. (Note: It appears that the object menus don't allow command line parameters to be passed on with the program name. Therefore the reason why each X10 command requires its own script.)
Once you have created all the scripts, it is necessary to set each *.CMD object with the correct working directory and session properties. Open the folder where the scripts are located in, right-click on one of the REXX script icons and select Properties. On the Program page, enter the Working Directory where the script is located at. See picture below for a sample. On the Session page, you can check the Start Minimized and Close Session on Exit box. This way, no command window will be visible when it is executed. For debugging purposes, you may uncheck both boxes. If the Working Directory is not filled in properly, the script will not be able to load the X10 DLL and fail to control the X10 devices.
Now it's time to create the actual object menu. Keep the folder with all the scripts open. Right-click on the desktop and select Properties. Select the Menu tab and click on the Create Another... button next to the Available menus list (top list). Enter the string X10 Control in the Menu name box and click OK. Click on the X10 Command entry that now appears in the Available menus list (top list). Now add all of the scripts to the menu. Simply drag each of the *.CMD scripts into the Actions on Menu: X10 Control list (bottom list).
You can check the menu you created by right clicking on the desktop. You will see an entry named X10 Control and when clicked on, all your scripts will show up in a secondary menu. To change the menu description to more meaningful names like Living Room ON, click on one of the entries in the Actions on Menu: X10 Control list (bottom list) and click on Properties... (located on lower half of notebook). Edit the Menu item name to your own liking. Should you type in the program name manually, make sure you include the drive and path of the script or the script will not be accepted. When the Menu Item Properties are opened again, the drive and path won't be shown. The Program name can not accept any command line parameters. See picture below for a sample menu composition.
Before you use the menu selections, make sure one of the Comm Engines
is running and connected to the X10 controller. (If you use X10 control
frequently, we recommend putting the Comm Engine into the start-up folder
and set the Auto-Connect and Minimize on Open
options). Your favorite lights or appliances can now be conveniently controlled
from the desktop pop-up menu as shown below. Simply right-click on the
desktop and click on X10 Control.
This neat trick nicely integrates any application into the OS/2 Desktop
and it was the "Creating object menus in OS/2" article in the December
1999 issue of Extended Attributes that gave us the extra push to complete
this work. If you have a chance, read that article for more details on
object menus. Information about the monthly Extended Attributes publication
can be found at the Phoenix OS/2 Society.
Return to the HOUSE/2 home page.