wiki:Documentation/ARexxAPI/WRITEEDITOR

Version 6 (modified by damato, 7 months ago) (diff)

--

Languages:

WRITEEDITOR

NAME
WriteEditor -- Pass an ARexx command to the internal editor. (V2.0)
TEMPLATE
VAR/K,STEM/K,COMMAND/A
FUNCTION
Passes an ARexx command to the internal editor to act upon the contents of a given Write window.

Quoting the TextEditor.mcc class autodoc, the following commands are currently supported:

 CLEAR
 CUT
 COPY
 PASTE
 ERASE
 GOTOLINE       Template: /N/A
 GOTOCOLUMN     Template: /N/A
 CURSOR         Template: Up/S,Down/S,Left/S,Right/S
 LINE           Template: /N/A
 COLUMN         Template: /N/A
 NEXT           Template: Word/S,Sentence/S,Paragraph/S,Page/S
 PREVIOUS       Template: Word/S,Sentence/S,Paragraph/S,Page/S
 POSITION       Template: SOF/S,EOF/S,SOL/S,EOL/S,SOW/S,EOW/S,SOV/S,EOV/S
 SETBOOKMARK    Template: /N/A
 GOTOBOOKMARK   Template: /N/A
 TEXT           Template: /F
 UNDO
 REDO
 GETLINE
 GETCURSOR      Template: Line/S,Column/S
 MARK           Template: On/S,Off/S
 DELETE
 BACKSPACE
 KILLLINE
 TOUPPER
 TOLOWER

Refer to the Amiga User Interface Style Guide for more info about these commands.

Please note that because of the internal use of the ReadArgs() function, the ARexx Host requires to escape certain special characters like a newline (0x0a) or escape character (0x1b) if you want to pass it i.e. with an TEXT command to the texteditor.

This means that you have to use the following escape sequences in your provided strings:

*N substitutes to 0x0a
*E substitutes to 0x1b
!** substitutes to *
*" substitutes to "

Please have a look at the examples below for a short example on how to use these escape sequences properly.

INPUTS
VAR/K - alternative variable to put the results into instead of RESULT
STEM/K - base name used for the stem where the result will be stored
COMMAND/A - the command string to be passed
RETURNS
VAR - info returned by the query
<STEM>RESULT - results of the command, if any

RC is set to 10 if no Write window was previously specified as "active" with MAILWRITE.

NOTES
EXAMPLE
/* Enable result codes */
OPTIONS RESULTS

/* Start a new mail */
MAILWRITE STEM st.
win = st.window

/* Edit the Write window */
MAILWRITE WINDOW win
WRITETO 'boss@example.com'
'WRITESUBJECT "I do not think I can go to work today"'

/* Clear the editor */
WRITEEDITOR CLEAR

/* Write some text into the editor */
'WRITEEDITOR "TEXT Sorry, but I am sick today!"'

/* Write some text containing a newline (*N) */
'WRITEEDITOR "TEXT Hello Joe,*N I would like to meet you."'
BUGS
SEE ALSO
MAILWRITE