ARexx and Macros Reference

 

 

Keyboard Macros

"Macros" are a common feature in many editors, and CodeBench is no exception. A macro is a collection of keyboard events which are formed into a list which can then be executed repeatedly to achieve a specific function. The possibilities are virtually endless, but do depend on the current project being worked on. For example, a keyboard macro could insert a fixed block of text or a code construct. Perhaps it could do some text formatting, there is no end to the possibilities.

Regardless of their function, keyboard macros are a useful feature, so we shall decribe how you can create and use them, and we shall discuss how they can be stored for use later.

 

Macro Manager

CodeBench includes its very own Manager window to allow you to load, record and execute macros in a very easy way.

MacroManager The manager window will not be opened by default in order to save some space on the screen, but this can be changed from the program preferences. If you only want to use the manager occasionally, you can use the "Windows/Keyboard Macros" menu item, which will open the manager on the CodeBench screen. The manager can also be opened from the button in the IconBar for your convenience or to bring the manager window into view if it hidden by other CodeBench components.

When the manager is used for the first time, there will not be any macros assigned. We can see here that the manager assigns macros to each function key on the keyboard. Up to 12 function keys are available, but you may limit this to less if so required from the popup menu as described below.

macrowinpopup The functions of the manager window are controlled by the use of popup menus. To access this, place the mouse pointer over the manager window making sure it is active, but not over a function key icon, and press the right mouse button.

This menu gives you the option to switch between a vertical or horizontal layout so as to fit in better with your current window position settings.
You may also limit the amount of displayed function keys. You can specify between 1 and 12. You may want to change this to make the window size smaller, or perhaps you either do not have 12 function keys on your keyboard, or feel you may never need to use 12 macros simultaneously.

Once some macros are assigned in the manager, you will also be presented with some saving options from this menu. We shall discuss that in detail later on.

 

The Macro Manager window also allows you to assign macros to the function keys.

The macro control in the manager is accessed by right-clicking the mouse over one of the function key icons in the window.The resulting popup menu now gives us a few options:

recording macro We can load a macro from disk and assign it to the function key the mouse pointer was over when the menu appeared. This means we can load the macro from disk that we created above, and assign it to the F1 key by placing the mouse over the F1 icon and clicking the right mouse button and selecting the "Load Macro" option. A file requester will appear asking you for the name of the macro you wish to load. Once you make your selection, you will notice the label for the F1 key changes from "<empty>" to the name of the macro you selected. By assigning macros to the function keys, it means we now have an easy way to execute these macros, simply press the function key which matches the macro you want. You may also click the function key icon with the mouse to execute the macro.

The popup menu also gives us the ability to be able to record a macro for this function key. Select "Record Macro" from the popup, and you will see the function key icon turn red and the label text change to "Recording...". This means that the Macro manager will now monitor what you type, and record those events in this macro. Currently, keypresses and cursor control are recorded, making macros that can insert blocks of code or words along with text placement controls. This also includes indentation etc. During recording, you will also notice that the status bar in the editor also shows what is happening, like so:

Status_Recording

Once you have finished recording the macro, bring up the popup menu again, and select "Stop Recording". A requester will appear asking you for a short "legend" for this macro. This legend should be descriptive enough to tell what the macro does but short enough to be displayable as the macro label. The function key will become active, and the label will change to the legend you specified. This macro is now saved in the manager, but not to disk. This makes it easy to generate macros for temporary use, as they do not absolutely need to be saved to disk, although storing some of the more complicated macros would save you having to create them each time you need them.

 

back to the top

 

Arexx Port

The Arexx port within CodeBench works just like any other. The name of the port will be shown in the screen title bar making it convenient when creating scripts. It will always be CBREXXPORT.x where "x" is the instance number of CodeBench. The commands that the port understands are described below.

 

back to the top

 

Supported Commands

Currently, the supported Arexx commands are:

ACTION

Template: ID/N/A, ACTION

Perform an action within the editor.

Supported actions are:

GO_UP_LINE
Move the cursor up one line.

GO_UP_PAGE
Move the cursor up one page.

GO_TOP_OF_DOCUMENT
Move the cursor to the top of the document.

GO_DOWN_LINE
Move the cursor down one line.

GO_DOWN_PAGE
Move the cursor down one page.

GO_BOTTOM_OF_DOCUMENT
Move the cursor to the bottom of the document.

GO_LEFT_CHAR
Move the cursor left one character.

GO_LEFT_WORD
Move the cursor left one word.

GO_START_OF_LINE
Move the cursor to the start of the current line.

GO_RIGHT_CHAR
Move the cursor right one character.

GO_RIGHT_WORD
Move the cursor right one word.

GO_END_OF_LINE
Move the cursor to the end of the current line.

NEWLINE
Insert a blank line at the cursor position.

DELETE_CHAR_LEFT
Delete the character to the left of the cursor.

DELETE_CHAR_RIGHT
Delete the character to the right of the cursor.

DELETE_WORD_LEFT
Delete the word to the left of the cursor.

DELETE_WORD_RIGHT
Delete the word to the right of the cursor.

DELETE_TO_START
Delete all the text to the left of the cursor.

DELETE_TO_END
Delete all the text to the right of the cursor.

UNDO
Undo the last operation.

REDO
Redo the last operation which was undone.

CUT
Cut the marked block of text from the document.

COPY
Copy the marked block of text from the document.

PASTE
Paste the contents of the clipboard to the current cursor position.

INDENT_SPACE
Indent the marked block of text with a space.

INDENT_TAB
Indent the marked block of text with a Tabulation.

UNINDENT
Unindent the marked block.

SELECT_CHAR_LEFT
Select the character to the left of the cursor.

SELECT_CHAR_RIGHT
Select the character to the right of the cursor.

SELECT_WORD_LEFT
Select the word to the left of the cursor.

SELECT_WORD_RIGHT
Select the word to the right of the cursor.

SELECT_TO_LINE_START
Select all the text to the left of the cursor.

SELECT_TO_LINE_END
Select all the text to the right of the cursor.

SELECT_UP
Move the cursor up one line and select the text inbetween.

SELECT_DOWN
Move the cursor down one line and select the text inbetween.

SELECT_PAGE_UP
Move the cursor up one page and select the text inbetween.

SELECT_PAGE_DOWN
Move the cursor down one page and select the text inbetween.

SELECT_TO_DOCUMENT_START
Move the cursor to the start of the document and select the text inbetween.

SELECT_TO_DOCUMENT_END
Move the cursor to the end of the document and select the text inbetween.

GETATTR

Template: ID/N/A, ATTR

Get certain attributes of the current file.

Supported arguments are:

PROJECTID
Get the ID number of the current project to use as a target for future commands. The ID parameter should be ZERO for this attribute, as it is ignored.

HAYT

Template: ID/N/A, STATE Turn the Help-as-you-Type window feature on or off temporarily. This is mostly of use during the execution of keyboard macros. This setting is not saved in the preferences, and is not permanent.

Possible arguments are:
DISABLE, ENABLE

KEYPRESS

Template: ID/N/A, KEY Insert a character at the current cursor position. This may be any printable character.

A quote enclosed printable character to act as a key pressed.

HELP

Displays this help text.

 

 

back to the top

Valid XHTML 1.0 Transitional This is a W3C checked and compliant webpage.