/* Takes the name of a script that the user has marked in RPC and loads the script into RPC. To use, perform the following steps (the first 2 are one-time only steps) Select Macro -> Add a macro. Choose this script name (open_script.rex) to add. Mark a script name in the current script you're editing. Select Macro -> open_script. */ OPTIONS "C_CALL NOSOURCE" /* Raise ERROR for any problems with RPC macro functions */ RexxEdErr = "ERROR" DO /* You need to first call EditGetDoc() at the beginning of your * macro. This does some bookkeeping to determine what document * (ie, editor window) the rest of the functions operate upon */ path = EditGetDoc() /* Get current selection */ EditGetText("temp_name") /* Parse out the filename */ PARSE VAR temp_name.1 temp_name.1 '(' . IF temp_name.1 = "" THEN RAISE ERROR 1 DESCRIPTION "Mark a script name for loading first" /* Assume same path as the current document */ script_name = FILESPEC('D', path) || FILESPEC('P', path) || translate(strip(temp_name.1)) /* If no extension, assume a .REX extension */ IF FILESPEC('E', script_name) == "" THEN script_name = script_name || '.rex' /* Open the script in an editor window */ EditOpenDoc(script_name) END CATCH ERROR CONDITION("M")