home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
CLPPASTE.ZIP
/
CLPPASTE.SPF
< prev
next >
Wrap
Text File
|
1991-02-08
|
3KB
|
82 lines
/***********************************************************************
MACRO: CLPPASTE
PURPOSE: Copies text from the clipboard to SPF/2
OPERATION: A program - CLP2FILE - gets text from the clipboard and
puts it to a file. It is then copied from the file into
the file being being edited after the A.
***********************************************************************/
'ISREDIT MACRO NOPROCESS'
TRACE OFF
quote = "'"
/* CLP2FILE copies text from clipboard to a file CLIP.OUT */
ADDRESS CMD 'CLP2FILE'
select
when RC = 0 then
do
/* sets the .ZDEST label where the A is */
'ISREDIT PROCESS DEST'
select
when RC = 0 then
do
'ISREDIT (last_line) = LINENUM .ZLAST'
'ISREDIT (copy_start) = LINENUM .ZDEST'
copy_start_sav = copy_start + 0
/* copy the file after the A */
'ISREDIT COPY CLIP.OUT AFTER .ZDEST'
/* calculate the number of lines copied */
'ISREDIT (new_last_line) = LINENUM .ZLAST'
copy_end = copy_start + (new_last_line - last_line)
copy_start = copy_start + 1
/* label the new lines */
'ISREDIT LABEL (copy_start) = .start'
'ISREDIT LABEL (copy_end) = .end'
/* change the at the end of the new lines to spaces */
'ISREDIT CHANGE all "" " " .start .end'
'ISREDIT RESET'
/* erase CLIP.OUT */
ADDRESS CMD 'ERASE CLIP.OUT'
endok = quote||'Clipboard contents have been copied after line '||copy_start_sav ||quote
'ISREDIT RESET'
'ISREDIT LINE_BEFORE .ZFIRST = NOTELINE ' endok
end
when RC = 8 then
/* if no A then error */
do
'ISREDIT RESET'
procerr = quote||'Destination for data not found - use line command A'||quote
'ISREDIT LINE_BEFORE .ZFIRST = NOTELINE ' procerr
end
otherwise
do
/* if a line command conflict then error */
procerr = quote||'Incomplete or conflicting line commands'||quote
'ISREDIT RESET'
'ISREDIT LINE_BEFORE .ZFIRST = NOTELINE ' procerr
end
end
end
when RC = 1 then
/* ADDRESS CMD returns a 1 if cannot find executable */
do
'ISREDIT RESET'
cliperr = quote||'Please place CLP2FILE.EXE in a sub-dir on your path'||quote
'ISREDIT LINE_BEFORE .ZFIRST = NOTELINE' cliperr
end
when RC = 2 then
/* CLP2FILE returns a 2 if clipboard is empty or has non-text data */
do
'ISREDIT RESET'
cliperr = quote||'Clipboard is empty or contains non-text data'||quote
'ISREDIT LINE_BEFORE .ZFIRST = NOTELINE ' cliperr
end
otherwise
/* CLP2FILE returns a 3 if clipboard cannot be opened */
do
'ISREDIT RESET'
cliperr = quote||'Clipboard cannot be opened'||quote
'ISREDIT LINE_BEFORE .ZFIRST = NOTELINE ' cliperr
end
end