7m…ôcUø \cd±(REM These routines come with no warranty andREM NOSUPPORT. I know that they fail forREM clips of over 32KREM Writes the TEXT at address B&, length L% toREM the clipboardPROC CopyToClip:(B&,L%) LOCAL W&,H%,RC%,A&,P&,DL&,pos& A&=ADDR(W&) RC%=IOOPEN(H%,"C:\System\Data\Clpboard.cbd",KIoOpenAccessRandom%+KIoOpenAccessUpdate%+KIoOpenModeReplace%) IF RC%>=0 REM It IS possible for the open to fail! REM store the UID header W&=&10000037 :IOWRITE(H%,A&,4) W&=&1000003B :IOWRITE(H%,A&,4) W&=&00000000 :IOWRITE(H%,A&,4) W&=&4739D53B :IOWRITE(H%,A&,4) REM Write dummy table offset for now; fill in later W&=0 :IOWRITE(H%,A&,4) REM store the buffer length W&=L% :IOWRITE(H%,A&,4) REM actually store the text IOWRITE(H&,B&,L%) REM store a nul byte W&=&00000000 :IOWRITE(H%,A&,1) REM Remember table offset IOSEEK(H%,3,pos&) REM write the contents table W&=&00000002 :IOWRITE(H%,A&,1) REM two entries W&=&10000033 :IOWRITE(H%,A&,4) REM Text UID W&=&00000014 :IOWRITE(H%,A&,4) REM file offset REM seek back to the content table offset position P&=16 :IOSEEK(H%,1,P&) REM write the content table offset W&=pos& :IOWRITE(H%,A&,4) REM complete, so close IOCLOSE(H%) GIPRINT "Copied",KBusyTopRight% RETURN ENDIF BEEP 5,300 :GIPRINT "!!NOT Copied:"+ERR$(RC%)+"!!",KBusyTopRight%ENDPREM Returns the address of an ALLOCed bufferREM The length of text in the buffer is storedREM in the LONG pointed to by BufLen_p&PROC CopyFromClip&:(BufLen_p&) LOCAL H%,UID&(4),Table&,N%,I%,Type&,Offset&,Length&,Buffer&,TT% IF IOOPEN(H%,"C:\System\Data\Clpboard.cbd",$0600)<0 GOTO NoClipboard ENDIF REM read the UID header IOREAD(H%,ADDR(UID&()),16) IF UID&(1)<>&10000037 OR UID&(2)<>&1000003B OR UID&(3)<>&00000000 OR UID&(4)<>&4739D53B REM This ISN'T a clipboard file GOTO NoPaste ENDIF REM read the contents table offset IOREAD(H%,ADDR(Table&),4) REM Go to the contents table IOSEEK(H%,1,Table&) REM Read the number of entries IOREAD(H%,ADDR(N%),1) WHILE N%>1 REM Read the type AND offset IOREAD(H%,ADDR(Type&),8) IF Type&=&10000033 REM The text chunk REM Go to the text chunk IOSEEK(H%,1,Offset&) REM read the length of text IOREAD(H%,ADDR(Length&),4) IF Length&<=0 :GOTO NoPaste :ENDIF REM Create a buffer to hold the text Buffer&=ALLOC(Length&) IF Buffer&=0 :GOTO NoPaste :ENDIF REM read the text ioread(H%,Buffer&,Length&) IOCLOSE(H%) REM save the length POKEL BufLen_p&,length& RETURN Buffer& ENDIF N%=N%-2 ENDWH NoPaste:: IOCLOSE(H%) NoClipboard:: GIPRINT "Nothing to paste"ENDPÐР   \cR efd\cZ efd ‚.ÆA…*TextEd.app…b ‰é