home *** CD-ROM | disk | FTP | other *** search
EPOC OPL Source | 1998-08-30 | 2.1 KB | 72 lines |
-
-
- Rem getclip, an addon command for Shell5
- Rem Read the system clipboard
- Rem
- Rem Copyright (C) 1998 Nick Murray
- Rem This routine was made possible by Cliplib.opl v 1.0
- Rem by Russ Spooner (psion@labrat.demon.co.uk)
- Rem
- Rem This program is free software; you can redistribute it and/or
- Rem modify it under the terms of the GNU General Public License
- Rem as published by the Free Software Foundation; either version 2
- Rem of the License, or (at your option) any later version.
- Rem
- Rem This program is distributed in the hope that it will be useful,
- Rem but WITHOUT ANY WARRANTY; without even the implied warranty of
- Rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- Rem See the GNU General Public License for more details.
- Rem
- Rem You should have received a copy of the GNU General Public License
- Rem along with this program; if not, write to the Free Software Foundation,
- Rem Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- Rem
- PROC getclip%:(n%)
- LOCAL h%,p&,end&,pos&,len&,base&,c%
- ONERR ErrTrap::
- IOOPEN (h%,"c:\system\data\clpboard.cbd",$200)
- pos&=20
- IOSEEK(h%,1,pos&)
- IOREAD(h%,ADDR(len&),4)
-
- base&=ALLOC(len&+4) Rem only NEED + 1 - because poking
- Rem the string length on the first entry would be at pos -1
- IOREAD(h%,base&+4,len&)
- h%=IOCLOSE (h%)
-
- end&=base&+len&+4
- p&=base&+4
- WHILE p& <= end&
- IOYIELD
- IF _stat%<>-46
- IF _key%(1)=27
- BREAK Rem this should ensure something is written!!
- ELSE
- KEYA(_stat%,_key%())
- ENDIF
- ENDIF
- IF (PEEKB(p&)=6) OR c%=253 OR p&=end& Rem newline in dialog or max characters
- POKEB p&-c%-1,c%
- fprint%:(PEEK$(p&-c%-1))
- c%=-(c%=253) Rem as we USE the 253rd character!
- ELSE
- c%=c%+1
- ENDIF
- p&=p&+1
- ENDWH
- FREEALLOC(base&)
- RETURN
- ErrTrap::
- ONERR off
- IF h%
- IOCLOSE (h%)
- ENDIF
- IF base&
- FREEALLOC(base&)
- ENDIF
- PRINT err$:(ERR)
- RETURN ERR
- ENDP
-
-
-