/* Inserts an address into an already done letter head. You may use the following fill-ins, when creating your letter head template: - -
- - - - - - You may write the part of the desired address anywhere to the letter head template. It is deleted by the script, before the parts of the address are inserted! Up to now every item may occur up to three times. This limit is done because of a bug (?) in CEDs Arexx-Port the __global__ replace does not work and a walk around had to be found! If YOU find another way of doing multiple replaces, please send me the modified script, so I can include it into the distribution --- Thanx. */ options results address 'rexx_ced' tabchar = '09'X cr = '0A'X /* Get contents of current line: */ status 55 line = result /* Get tab size: */ status 8 tabadjust = result - 1 /* Get cursor x position (relative to beginning of line = 1): */ status 46 cur = result + 1 i = index(line,tabchar) DO while i > 0 & i <= cur - tabadjust cur = cur - tabadjust i = index(line,tabchar,i+1) END /* If the current character is non-alphabetic, then start one character over to the left. This allows the cursor to be immediately after the key word (say on a space or bracket.) */ char = substr(line,cur,1) if (~(datatype(char,'A') | char = '_') & cur > 1) then cur = cur - 1 /* Find leftmost and rightmost alphabetic character adjacent to current: */ right = cur - 1 left = cur + 1 char = 'A' DO while (datatype(char,'A') | char = '_') & (left > 0) left = left - 1 if left > 0 then char = substr(line,left,1) END char = 'A' DO while (datatype(char,'A') | (char = '_')) right = right + 1 char = substr(line,right,1) END if right-left <= 1 then DO getstring target = result if (target = 'RESULT') then exit END else DO target = substr(line,left+1,right-left-1) END DO say 'Searching for address' target '...' if ~show(ports, DFA) then do 'okay1' 'You should have DFA running, if you' cr 'want to get an address from it!' exit 0 end address 'DFA' "SEARCH" target "IGNORECASE FIELDS=ALL STEM ADR." if rc=0 then do "Prev WORD" "Mark BLOCK" "NEXT WORD" "CUT BLOCK" "Beg of File" "Replace" '
' ADR.ADDRESS.0 "Replace" '
' ADR.ADDRESS.0 "Replace" '
' ADR.ADDRESS.0 "Beg of File" "Replace" '' ADR.ADDRESS.2 "Replace" '' ADR.ADDRESS.2 "Replace" '' ADR.ADDRESS.2 "Beg of File" Replace '' ADR.ADDRESS.1 Replace '' ADR.ADDRESS.1 Replace '' ADR.ADDRESS.1 "Beg of File" Replace '' ADR.ADDRESS.3 Replace '' ADR.ADDRESS.3 Replace '' ADR.ADDRESS.3 "Beg of File" Replace '' ADR.ADDRESS.4 Replace '' ADR.ADDRESS.4 Replace '' ADR.ADDRESS.4 "Beg of File" Replace '' ADR.ADDRESS.5 Replace '' ADR.ADDRESS.5 Replace '' ADR.ADDRESS.5 "Beg of File" Replace '' ADR.ADDRESS.6 Replace '' ADR.ADDRESS.6 Replace '' ADR.ADDRESS.6 "Beg of File" /* Get date */ address command 'c:date > ' 'ram:tmp_date' /* Clear Date */ Replace '' "" /* Insert Date from temporary file */ include file "ram:tmp_date" /* Delete all stuff from date string that */ /* is not wanted */ "Mark block" "Next word" "Cut block" "text" ' ' "Next word" "Next word" "Next word" "Next word" "Next word" "Delete to EOL" /* Get date */ address command 'c:date > ' 'ram:tmp_date' /* Clear Date */ Replace '' "" /* Insert Date from temporary file */ include file "ram:tmp_date" /* Delete all stuff from date string that */ /* is not wanted */ "Mark block" "Next word" "Cut block" "text" ' ' "Next word" "Next word" "Next word" "Next word" "Next word" "Delete to EOL" /* Get date */ address command 'c:date > ' 'ram:tmp_date' /* Clear Date */ Replace '' "" /* Insert Date from temporary file */ include file "ram:tmp_date" /* Delete all stuff from date string that */ /* is not wanted */ "Mark block" "Next word" "Cut block" "text" ' ' "Next word" "Next word" "Next word" "Next word" "Next word" "Delete to EOL" /* Delete temporary date file */ address command 'c:delete ' 'ram:tmp_date' end else 'okay1' 'Could not find address of' target '! ' END exit