If you are an experienced OS/2 user, this chapter is very much a review you may want to skip entirely. In this chapter I discuss installing REXX if you have not done so, accessing the on-line help system, using the Enhanced Editor and using templates to install REXX programs on the desktop or in a folder once they are running. If you have installed REXX already and are familiar with these other topics, feel free to skip ahead to Chapter 2.
Unlike the OS/2 batch language, support for REXX programs is not automatically installed when you installed OS/2. You had to physically select it. If you did not install REXX, you will need to go back and add it to your installation. The steps are:
You now have REXX installed and ready to use.
Since you are interested in learning REXX, one of your best tools-besides this book-is the on-line documentation for REXX. This on-line documentation is installed at the same time you install REXX. It documents all of the features and syntax of the REXX language. Because this information is so readily available, I have not tried to duplicate the same information in this book.
The REXX on-line information is located in the Information folder. You will be accessing this information a lot while learning and using REXX so it's a good idea to make the on- line documentation more accessible by making it available from the desktop. The easiest way to do that is to create a "shadow" of the REXX Information program in the Information folder and keep that shadow on the desktop. To do this, click on the REXX Information icon using the right mouse button and select "Create shadow" from the menu. When it asks you for a location, select the desktop.
Since you will be using the REXX on-line documentation a lot, let's take a few minutes review how to use it. Since it is used just like the OS/2 on-line documentation, you may want to skip this discussion if you are familiar with OS/2 on-line documentation already.
When you first open the on-line documentation, you see the contents page as shown in Figure 1-3. This is the page you use to access the particular information you are looking for. Notice that all of the topics, except the first one, has a plus sign beside it. That means that subheadings are available. To see a subheading, move the black bar to that topic and press the plus sign. Figure 1-4 shows this. Once you have found the particular heading or subheading you are interested in, you can press return to see the information under that topic. Figure 1-5 shows this. When a word or phrase is highlighted, as you see in Figure 1- 5, you can double-click on that highlighted information to display additional information. Some of the REXX topics also have "Example" buttons you can double-click on to see one or more examples of REXX code using the concept being discussed.
Many times, you will find it easier to search for a phrase or command than to look through the contents. To do that, first click on the "Search" button. That will bring up a dialog box where you can enter the word or phrase to search on. Figure 1-6 shows this. Once the search is finished, it will show you a list of topics that contained the word or phrase you entered. Figure 1-7 shows this. You can then select any of these topics to review.
If you find you are using a few topics a lot, you can insert a "bookmark" to let you jump to that section quickly. To insert a bookmark, first find the text to mark. At that point, select Bookmark from the Services menu. Make sure the Place button is selected and enter the name for the bookmark. Figure 1-8 shows this. This same menu option is used to quickly display existing bookmarks as well as to delete them once you do not need them anymore.
Before you can begin to write REXX, you need a tool to do your writing with. OS/2 comes with the perfect tool, its Enhanced Editor in the Productivity Folder. This section presents a brief tutorial on starting and using the OS/2 Enhanced Editor. It concentrates on those features most useful for writing REXX. For more information on all its features, see your OS/2 documentation.
Before I cover the OS/2 Enhanced Editor, let me say a few words about alternatives. Almost any word processor or editor-no matter how simple or advanced it is-can be used to write REXX programs. REXX programs must be saved as unformatted text. Any editor or word processor that can save unformatted text (also called ASCII or plain text) can write REXX programs. If you are not sure about your editor, try creating a small REXX program with it and saving it as unformatted. Then try to run that program. If it runs ok, then your editor is fine.
I have found that DeScribe 4.0 using the ASCII template works very well for writing REXX programs. Its one drawback is you must close the program file in DeScribe before you can run it from the command line. This is a limitation of DeScribe and not OS/2 or REXX.
The Enhanced Editor is fairly powerful for an editor. It offers features like search and replace, moving text, word wrap and editing multiple files. In fact, if your needs are simple, you could use the Enhanced Editor for all your word processing. This section presents a tutorial to the Enhanced Editor. If you are experienced with editors in general you might want to skip the first few subsections. If you are already familiar with the OS/2 Enhanced Editor or you plan on writing your REXX programs with your word processor or another editor, you might want to skip the rest of this section altogether and jump ahead to the section on executing a REXX program.
To help you understand the file format used by the Enhanced Editor, let's try an experiment first. Create a small file (say one or two paragraphs) with the word processor you normally use. Be sure to format all the text like you normally would. When you have finished, save the file and exit your word processor. Now, drop out to the OS/2 command prompt and change to the subdirectory containing your file. Once you have done that, issue the command "TYPE MYFILE.TXT" only change MYFILE.TXT to the name you used to save your file.
This command causes OS/2 to display the contents of your short file to the screen. You should see most of the text you entered in the file. However, you should also see a lot of characters you did not type. These characters contain the formatting information your word processor adds to the file. Some word processors, like Microsoft Word, add file summary information to files and you will see these characters as well.
While this information is useful to your word processor and help makes your file look attractive when it is printed, it is poison to a REXX program. REXX programs must be saved containing the text you enter and nothing else. This format is called an ASCII file. ASCII files are sometimes called unformatted or plain files. The Enhanced Editor creates ASCII files automatically. To see this, create a small file with the Enhanced Editor, save it and then exit to the OS/2 command prompt and type that file to the screen with the command "TYPE MYFILE.TXT" only again using your file name. This time, you will not see any extra characters.
Because of the Enhanced Editor's limited formatting abilities, it's not the best choice for serious word processing. However, the Enhanced Editor is one program where it's safe to format your REXX programs for printing since it stores all formatting information in the Extended Attributes file. In addition to writing REXX programs, it's great for editing system files like your CONFIG.SYS file, keeping simple todo lists if the OS/2 Todo program is not to your liking and for writing brief memos or notes to yourself. It's also a good way to view the documentation files that come with more shareware packages even if you have no intentions of making any modifications to these files.
The Enhanced Editor is stored in the Productivity folder, which is stored inside the OS/2 System folder. The steps and figures below assume that you have left the Enhanced Editor in that location. If you've moved, you'll have to alter these steps. Figure 1-9 below shows a typical OS/2 desktop. Move the mouse cursor to where it is inside the OS/2 System icon (on the left near the top) and press the left mouse button twice very quickly. (Pressing the left mouse button twice very quickly is called "double clicking.") This opens the OS/2 System folder. Your system should look something like the one shown in Figure 1-10.
Next, move the mouse cursor over the Productivity folder and again double click the left mouse button. This opens the Productivity folder. You system should look something like the one shown in Figure 1-11. Move the mouse cursor over the Enhanced Editor icon and once again double click. This opens the editor with a blank file ready to accept characters. Figure 1-12 shows this.
I use the Enhanced Editor a lot so I created a "shadow" icon on the desktop itself to speed starting the Enhanced Editor. To do this, click on the Enhanced Editor icon using the right mouse button and select "Create shadow" from the menu. When it asks you for a location, select the desktop. After that, you can quickly start the Enhanced Editor by double clicking on this shadow.
Notice in Figure 1-12 that there is a line saying "=====Top of File=====" at the top and one saying "=====Bottom of File=====" at the bottom. These are there as markers. You can not delete them and they are not saved as part of the file you are creating. Also notice from Figure 1-12 that the Enhanced Editor has a status line at the bottom of the screen, a menu along the top of the screen and a title bar above the menu screen.
We will explore the menu bar later but let's take a minute to review the status line at the bottom of the screen and the title at the top. Figure 1-13 shows the Enhanced Editor being used to edit an early draft of this chapter. At the time I took this screen show, I was editing line 67 of 67 so the file had 67 lines in it and I had the cursor on the last line of the file. The cursor was near the right side of the screen in column 110. I only had this one file loaded into memory so the status bar showed "1 File". I had the Enhanced Editor in insert mode so if I move the cursor to the middle of the file and start typing, the new characters are inserted rather than overwriting existing characters. Finally, the file had been modified since the last time I saved it so the status line displayed a "Modified." From the top of the screen, you can see that the name of the file I was editing was "D:\BOOK11\EDITOR.DOC".
If you have not yet done so, start the editor so you can follow along with this example. Notice that there is a flashing vertical black line on the screen. This is the cursor. It is always located on the space where the next character will be inserted into the file. The line and column numbers on the status line are referring to the position of this cursor.
One of your most common editing activities will be to move this cursor around to different locations to insert or delete text. The Up, Down, Left and Right cursor keys move the cursor one space in the associated direction. The Control-Left and Control-Right cursor key combinations moves the cursor one word in the associated direction. PgUp and PgDn move the file one page in the associated direction. Ctrl-PgUp moves the cursor to the top of the current page while Ctrl-PgDn moves it to the bottom of the current page. Home moves the cursor to the to the beginning of the current line while End moves it to the end of the current line. Ctrl-Home moves the cursor to the beginning of the file and Ctrl-End moves it to the end of the file. Table 1-1 summarizes this.
Moving the cursor around with these keys can be cumbersome when you need to move the cursor up twelve lines and over eight words. Fortunately, the Enhanced Editor has a speedier way. In addition to the text cursor, you should see a mouse cursor. It looks like a large capital "I" with the top bars bent up and the bottom bars bent down. If you move it outside the editing area, it changes to an arrow. To move the text cursor quickly to any point on the screen, move the mouse cursor there and click once.
The mouse cursor can also be used to easily scroll around the file. The small gray bar along the right side of the screen is called a "mouse elevator." A smaller gray bar indicates the current position in the file. Clicking above this bar works just like pressing PgUp while clicking below it is just like pressing PgDn. Notice that there is also a mouse elevator above the status bar for moving the file to the left or right when it is too wide to fit on a single screen.
Go ahead and create the following five-line REXX program by entering the text using the Enhanced Editor exactly as it is shown below :
/* Simple REXX Program */
SAY "This Is A Simple REXX Program Example"
SAY "The Name Of This File Is SAMPLE.CMD"
SAY "You'll Use SAMPLE.CMD To Illustrate"
SAY "Using Enhanced Editor"
Save the file by pressing the F2 key and using the name SAMPLE.CMD. This is a simple OS/2 REXX program. The SAY command causes the text that follows to be displayed on the screen. We will cover the commands in a later chapter so don't worry about that now, this is just sample text to learn the editor with.
To see how to insert text, move the text cursor to the left of the "REXX" on the first line. Check the status bar to make sure the Enhanced Editor is in insert mode (if you see a "Replace" then press the Ins key to toggle to insert mode.) Now, type in "OS/2". See how the text to the right of the cursor moves over to make room for the new text. Now move the cursor to the "You" on the third line and press the Ins key to toggle to overstrike mode. Notice that the "Insert" at the bottom of the screen changes to a "Replace" and the text cursor changes to a black box that covers one character. The character it is covering is the one that is about to be replace. Type "We" to replace "You" and press the Del key to delete the remaining character.
As I introduced above, the Del key is one way to delete characters. In replace mode (also called overstrike mode) pressing the Del key deletes the character inside the cursor. In insert mode, it deletes the character to the right of the text cursor. In either replace or insert modes, pressing the Backspace key deletes the character to the left of the text cursor key.
There are two other ways to delete text and you generally use these on larger blocks of text. With both of these approaches, you begin by highlight the text to delete. To highlight with the mouse cursor, you move the mouse cursor to the first character to delete, press and hold the right mouse button and drag the cursor to the last character to delete. As you do this, everything you are highlighting is shown inside a black box. To highlight text with the cursor key, move the text cursor to the first character and hold down the shift key while using any of the cursor movement keys to move the text cursor to the last character to delete. Using either method, once the text is highlighted you can press the Del key to delete it or simply begin typing. The first letter you type placed in the file and all the highlighted text is automatically erased.
I should mention that some keyboards have trouble selecting text using the keyboard method. My Gateway 2000 computer will only do this using the cursor arrow keys next to the letters. The cursor pad on the far right just enters numbers when you press the shift key. If you have trouble with your keyboard, you might want to experiment with using different cursor keys, turning on the NumLock and trying both Shift keys.
We now need to cover some of the Enhanced Editor menu items. Like most OS/2 programs, you have two ways to access the menus. The first is to move the mouse cursor to the desired menu and click once. You can also use the keyboard. First, press the Alt key. That causes the File menu to be highlighted. Use the arrow key to highlight the desired menu and then press Enter to bring up that menu. If you are using a mouse, you can point to the option you want from a menu and click on it to execute it. If you are using the keyboard you move the highlight to the desired option and press return. Figure 1-14 shows an early draft of this chapter with the File menu pulled down.
To save a file, you pull down the File menu and select the Save option. Notice that this option has an "F2" shown out beside it. That indicates that pressing the F2 function key is a "keyboard shortcut" that lets you save a file quickly without the need to work through all the menus. Any menu option that has a keyboard shortcut will have it printed on the menu as the Save command does. If you use the Enhanced Editor a lot, you will want to learn to use a few of the more common keyboard shortcut keys as pressing F2 is the fastest way available to save a file.
To open a file that already exists on the disk to either edit, print or read, bring up the File menu and use the Open command. If you want to start a new file without having to exit the Enhanced Editor first, bring up the File menu and use the New command.
The File menu offers the following additional commands:
The Edit menu is used primarily for working with blocks of text. Recall from the discussion above that text can be selected using either the keyboard cursor keys or the mouse cursor. Once that block is selected, in addition to deleting it, you can use the Edit menu to operate on it. Selecting Copy from the Edit menu places a copy of the text in the paste buffer without disturbing the original text. The paste buffer is a special holding area for text. Only one block of text can exist in the paste buffer at a time so if there is already text in the paste buffer then selecting the Copy command replaces the text currently in the paste buffer with the highlighted text. If you select Cut rather than Copy, then the text is still placed in the paste buffer but it is also removed from the file.
Once there is text in the paste buffer, you can move the text cursor to any location you like and copy the text in the paste buffer to the file using the Paste command. Doing this does not disturb the text in paste buffer so you can make as many pastes of the same text as you like. Cutting and then pasting is how you move text around in the file. Copying and pasting is how you make copies of text in the file. The text remains in the paste buffer as you move between files (but not when you quit the Enhanced Editor) so this is an easy way to copy or transfer text between different files.
Another function of the Edit menu is to let you "undo" or reverse changes you have made. It offers two options for doing this, Undo line and Undo. The Undo line command lets you reverse any changes you have made to the current line. Once you move the cursor off the current line, the Undo line command no longer works. If you select the Undo line command by accident, you can select it again to reverse the undo operation.
The Undo command lets you undo commands even after you have moved off that line. When you select the Undo command, it brings up a dialog box with a mouse elevator. As you click on the mouse elevator, successive actions are reversed. You should be able to see the changes taking place on the screen underneath the dialog box. This box allows you to reverse multiple changes.
The Enhanced Editor offers search as well as search and replace. Go back to the original SAMPLE.CMD program and move the cursor to the top of the file with the Ctrl-Home command. Select the Search menu and then the Search command from that menu. This brings up a dialog box where you enter the text to search for and optionally, the text you want to replace it with. For practice, try searching for the text "name" without replacing it with anything. Once the Enhanced Editor locates the text, it draws a circle around it. Had you misspelled a command, you could have the Enhanced Editor go ahead and replace the misspelling with the proper spelling by entering it in the replace field.
There are five options buttons for a search or search and replace:
Once you have entered your search text and optionally your replace text, there are six different buttons at the bottom you can use to start the process:
The final REXX program should look like this:
/* Simple REXX Program */
SAY "This Is A Simple OS/2 REXX Program Example"
SAY "The Name Of This File Is SAMPLE.CMD"
SAY "We'll Use SAMPLE.CMD To Illustrate"
SAY "Using Enhanced Editor"
Often times, it's useful when writing a new REXX program to have an existing program handy to look at to copy some of the syntax. The Enhanced Editor allows you to scroll between several different files. You can copy the commands you are interested in from the existing file and paste them into the new file. The Enhanced Editor also gives you several different ways that you can look at both files at once.
The first way is to put both files on the screen at once. To do that, first load the existing file into the Enhanced Editor. Move the mouse cursor to the very right of the screen. It will turn into a two-sided arrow. Press the left mouse button and drag the border to the middle of the screen. If you need to reposition the smaller screen, you can move the mouse cursor to the title bar and while holding down the left button, move the window to where you want it. Next, use the Open command to open the next file (or the New untitled command to start a new on) and use the same technique to size it and place it beside the original screen. Using this approach, you can look at both files at once. Use the mouse cursor to click on one or the other to make that screen the active screen for editing the file.
If you want to switch between different files for editing but don't need to see more than one at a time, then ring editing is a better approach since it lets you use the entire screen for one file. First, pull down the Options menu and move to the right of the Preferences menu. Move the cursor down to the Ring enabled menu and press return. Two buttons that look like rings will appear near the top right of the screen. Next, pull down the File menu. It will now have a new option, Add file. This lets you insert another file to edit into the ring of files. You use the Quit command from the File menu to remove the current file from the ring.
You have two different ways to switch between the various files in the ring. The first is to click on either of the two rings at the top of the screen. They move you in different directions through the ring. The second method is to use the List ring command from the Options menu. This lists the titles of all the files. To switch to one, highlight it and click on the Switch button.
The Enhanced Editor has one annoying habit that I find really gets in the way of writing REXX programs. It knows that certain REXX commands require multiple components and it tries to help you by automatically adding these components when you start entering a command. For example, enter "IF" at the beginning of a line and it automatically expands it so you have:
IF
then
else
DO and other multi-line commands are similarly expanded. If you find this useful, then by all means leave it in place. I find it distracting plus I use a different capitalization scheme so I end up typing over it anyway.
You can turn it off for a single session by selecting the "Command" menu, then "Command dialog..." and entering the command "EXPAND OFF" on the command line, without the quotation marks. This only affects the current session.
To turn command expansion off permanently, create a file called PROFILE.ERX in the subdirectory containing EPM.EXE, the Enhanced Editor program. This is usually C:\OS2\APPS but you can use FF.CMD to find its location on your system. This file should contain the following two lines exactly as below, with the quotation marks:
/* EPM Profile */
"EXPAND OFF"
Now, on the "Command dialog..." command line, enter the command "PROFILE ON", again without the quotation marks. Now, select the "Options" menu and "Save options" to save this configuration. Command expansion will now be turned off for all future sessions.
If you find learning the Enhanced Editor too much just to create a few REXX programs and you are looking for something simpler, OS/2 has just the thing for you. It's called the System Editor. It's much like a stripped down Enhanced Editor. Under the File menu, you'll find New, Open, Save, Save as and Autosave and nothing more. Under the Edit menu, you'll find an Undo button, the block commands of Cut, Copy and Paste, a Clear command to erase the highlighted block, and Find and Select all commands. The Option menu lets you set the color and font and turn word wrapping on and off. That's it, nice and simple.
OS/2 offers you two different ways to start your REXX programs. In this chapter, I'll show you both ways using the SAMPLE.CMD program as an example. If you did not create SAMPLE.CMD, you will find a copy of it on the disk included with this book. Just to refresh your memory, SAMPLE.CMD is shown below:
/* Simple REXX Program */
SAY "This Is A Simple OS/2 REXX Program Example"
SAY "The Name Of This File Is SAMPLE.CMD"
SAY "We'll Use SAMPLE.CMD To Illustrate"
SAY "Using Enhanced Editor"
The function of these commands will be explained in detail later. Briefly, this program will display four lines of information.
SAMPLE.CMD needs to be copied to a subdirectory that is in your path. As a general rule, it's a good idea to collect all your REXX programs together into a single subdirectory (I use F:\REXX on my system) and to include that subdirectory in your path.
To create a subdirectory to storing your REXX programs in, open the OS/2 System folder and then the Command Prompts folder. Double click on the OS/2 Full Screen icon to get to the OS/2 command line. Move to the root directory with the "CD\" command. Now, create the subdirectory with the "MD REXX" command. You can change to this subdirectory with the "CD\REXX" command. Copy SAMPLE.CMD from its current location with the COPY command. Finally, enter "EXIT" to return to OS/2. Now, you need to add this subdirectory to your path command. Unlike DOS, OS/2 keeps its path command in its CONFIG.SYS file. This is stored in the root directory of the drive containing OS/2. Open this file with either the System Editor or the Enhanced Editor. You will see a line for the path command. Append this new subdirectory by adding a ";C:\REXX" to the end. Of course, you should use the drive and subdirectory appropriate to your system. You should enter the semicolon but not the quotation marks. This change will take effect the next time you start OS/2. You will want to do that before going on to the next section.
The easiest way to run a REXX program is to get to an OS/2 command prompt and just enter name of the program on the command line. If the subdirectory containing the REXX program is in your path, you can run the REXX program from any location on your hard disk. Figure 1-15 shows SAMPLE.CMD running in an OS/2 window.
OS/2 is a graphical user interface and it naturally seems backwards to go to a command line to run a program. Fortunately, OS/2 makes it easy for you to install a REXX program as an icon either on your desktop or in a folder. That way, all you have to do is double click on the icon to run the REXX program. The steps for installing SAMPLE.CMD as a desktop icon are described below.
The first step is to open the Template folder. OS/2 uses templates to install new items. Figure 1-16 below shows a desktop with the Template folder open. As is the case with all these screen shots, your screen may look different depending on how you installed OS/2.
Next, move the mouse cursor over the Program icon and press and hold down the right mouse button. Drag the icon off out of the folder and onto the desktop. With templates, this creates a new copy at the location you drag it to. To position the icon inside a folder, open that folder first and drag the Program icon to that folder. As soon as you release the right mouse button, OS/2 brings up the first page of a dialog box you fill out on every new program. On this Program page, you enter the path to the REXX program and its the name. Optionally, you can enter parameters to pass to the program and the subdirectory it should start working in. Figure 1-17 shows this.
The next page is the Sessions page, as shown in Figure 1-18. Here you tell OS/2 what type of session to run and how to handle the window when the program terminates. Notice that some of the options are grayed out in Figure 1-18. Since OS/2 knows from the extension that SAMPLE.CMD is an OS/2 REXX program or an OS/2 batch file, it does not give you the option of running it in a DOS or Windows window. The next page is the Association page (Figure 1-19) and this is used to link data files to programs. This page is generally not used for REXX programs.
The next page is the Window page, shown in Figure 1-20. This window is used to control the behavior of the OS/2 window while the program is running. It too is generally not used for REXX program. The final page is the General page, shown in Figure 1-21. This page is used to enter a title for the icon and optionally redesign the icon to appear any way you want it to look.
Once you have filled in the necessary information, you can close this dialog box and the icon is ready to use. Figure 1-22 shows an OS/2 desktop with an icon to run SAMPLE.CMD installed. To run the REXX program, all you do is double click on its icon. From that point on, it runs just like it would if you had run it from an OS/2 command line.
Since OS/2 is a graphical user interface, each program that you wish to run by double clicking on it from the desktop needs an icon. Icons need to have three characteristics. These are:
While these three seem very limiting at first, you will quickly find that it is still possible to create some very artistic icons for your programs.
There are three different ways to develop icons for your programs. These are:
To draw your own icons or modify existing icons, you need to use the OS/2 Icon Editor so let's take a moment to explore this program. This is not a complete tutorial on the Icon Editor but it will tell you enough to work with REXX program icons. For more detailed information, consult your OS/2 on-line documentation.
There are three ways to start the Icon Editor. The first is to double click on the program. It's stored in the Productivity folder. The other two first require you to select the Settings menu, select the General page and then click on either "Edit" or "Create another" beside the picture of the existing icon. Except that the "Edit" button loads the existing icon into the Icon Editor, all three methods take you to the same screen.
You might want to start the Icon Editor now to follow along in this tutorial. Once you start the Icon Editor, your screen will look like the screen in Figure 1-23. Along the top of the Icon Editor, you see the main menu. Below that, you see several pieces of information:
The File menu has four options that are particularly useful for editing REXX programs icons. They are:
The Edit menu has seven options that are particularly useful for editing REXX programs icons. They are:
Under the Tool menu, you will find an "Color fill" option. This replaces the pen cursor with a tiny paint can. Everywhere you click the cursor, the pixel you click on and every other pixel of the same color connected to that pixel is changed to the currently selected color. This is a quick way to fill the interior of items in your icons.
Now that we have finished our tour of the Icon Editor screen and it's more important menu items, let's see how to draw an icon. The Icon Editor lets you work with a palette of sixteen colors. You will see these to the right of the work area. Additionally, you will see a color labeled "Screen" and "Inverse". The screen color always displays as the same color as the OS/2 desktop screen and makes your icons look professional by giving them a "clear" background. The inverse color is the color that contrasts best with the desktop color.
The Icon Editor allows two colors to be active at once. Move your mouse cursor to one color and press the left button. That is the color that will be painted while you hold down the left button. Now, move the pointer to another color and press the right button. That is the color that will be painted while you hold down the right button. Normally, I set the left button up the be the color I'm working with at the time and the right button to be the background color for the area I'm working in. That way, if I click in the wrong spot using the left button, I can quickly erase my mistake by clicking in the same spot with the right button.
Now we are ready to edit. The best way to think of an icon is a matrix with 32x32 dots. All we are going to do is change the colors of some of the dots in this matrix. We can do this by moving the mouse cursor to a particular pixel and clicking either mouse button or by holding down either mouse button and dragging the mouse cursor across the screen.
By way of an example, let's draw an icon of a 5.25 inch floppy disk. A 5.25 inch floppy disk is mostly a black square with holes in it so let's begin by drawing a black square. You'll see this in Figure 1-24. There are two notches at the front of the disk (one pixel each) and one larger notch (four pixels) on one side of the disk. You'll see these added in Figure 1-25. There is a large hole in the middle for the disk hub, a smaller hole near the front of the disk where the disk is read and a tiny hole (one pixel) near the large center hole. You'll see these added in Figure 1-26. Finally, the hole in the front is entirely filled with the gray center platter of the disk and some of that platter is visible in the large hole in the center. You will see these added in the final version of the icon in Figure 1-27. Save the icon to a disk file and you are ready to use it.
When you go to install an icon for a REXX program, OS/2 gives you four different ways to create/install it. You can have a disk file ready, create a new icon from the General page of the Settings notebook, paste an existing icon from the paste buffer in the General page of the Settings notebook or drop-and-drag. Let's look at each of these in more detail.
An icon file is a file created with the Icon Editor that contains one icon and has an .ICO extension. If an icon file exists in the same subdirectory as a program and has the same name, when you use a template to install that program to the desktop or to a folder, then OS/2 will automatically use that icon for the program.
For example, assume you have a REXX program called SAMPLE.CMD in your C:\REXX subdirectory that you are planning to add to your REXX folder. Just use the Icon Editor first to create SAMPLE.ICO and save it to your C:\REXX subdirectory. Now, when you install SAMPLE.CMD, OS/2 will automatically use SAMPLE.ICO as its icon.
If you do not have a previously created icon, you can click on the "Create another" button on the "General" page of the Settings notebook. This will take you to the Icon Editor and automatically have you working on the icon for the program you are installing. If you just want to modify the default folder icon used for folders or the box icon used for programs, just click on the "Edit" button rather than on the "Create another" button.
If you have previously used the Icon Editor and have copied an existing or modified icon to the paste buffer, you can use that icon to replace the default icon for a program. Just click on the "Create another" button (the "Edit" button will not work for this) on the "General" page of the Settings notebook to go to the Icon Editor. Now, select "Paste" from the Edit menu to paste the icon in the paste buffer into the Icon Editor.
If another item on your desktop using the same icon you wish to assign to an item, then making that assignment is as easy as dragging the icon and dropping it in place. First, bring up the Settings Notebook for the item that is to have its icon changed and change to the General page. Now, click on the item that has the icon you wish to use, using the right mouse button. Hold down the right mouse button and drag the item to the General page and release the mouse button. The new icon will be dropped into place.
Before you can use REXX, you must install it. This chapter has briefly outlined how to install REXX and access the on-line help.
This chapter has explained how to use many-but not all-of the features of the Enhanced Editor. Rather than trying to cover all it's features, I've concentrated on those you are most likely to use while creating and editing REXX programs. To learn about its remaining features, check on the on-line documentation for OS/2 or pick up a general purpose OS/2 book.
This chapter has showed you to different ways to run REXX programs, from the command line and as an icon. It also showed you how to store your programs in a common subdirectory and include that subdirectory in your path statement so they will run from any subdirectory.
© 2002 by Ronny Richardson, All Rights Reserved