Am trying to write a simple RPC macro that will translate selected text in a file to lowercase. Here is my attempt (most comments removed)
LIBRARY rexxgui
rexxederr = "ERROR"
DO
PATH = editgetdoc()
DO
editgettext("temp_name")
CATCH ERROR
guisay("Mark text for conversion to lowercase first")
RETURN
END
l_case = 'abcdefghijklmnopqrstuvwxyzåäö'
u_case = 'ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ'
temp_name.1 = TRANSLATE(temp_name.1, l_case, u_case)
editselect(,,'Temp_name')
END
CATCH ERROR
CONDITION("M")
Obviously I'm doing something wrong, because I start off with the following text /* Pull the whole file into the stem variable SOURCECODE. */ filein = 'tracelit.rex' CALL STREAM(filein, 'C', 'OPEN READ') CALL LOADTEXT('sourcecode.', filein) CALL STREAM(filein, 'C', 'CLOSE') search_arg = translate('when next_arg == ') If I mark the string "OPEN READ" and run the macro above,I get DO /* Pull the whole file into the stem variable SOURCECODE. */ filein = 'tracelit.rex' CALL STREAM(filein, 'C', '') open read CALL LOADTEXT('sourcecode.', filein) CALL STREAM(filein, 'C', 'CLOSE') search_arg = translate('when next_arg == ') tracelit_args = '/' note how the line has been split in two parts. Am I doing somethng wrong or just trying to use RPC macros for more than they were intended ???? |