Page 1 of 1

Re: MacPascal & the Clipboard

Posted: December 20th, 1984, 12:42 am
by Info-Mac
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10 UW 5/3/83; site uw-beaver
Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!houxm!vax135!cornell!uw-beaver!info-mac
From: info-mac@uw-beaver (info-mac)
Newsgroups: fa.info-mac
Subject: Re: MacPascal & the Clipboard
Message-ID:
Date: Mon, 19-Nov-84 21:56:43 EST
Article-I.D.: uw-beave.2289
Posted: Mon Nov 19 21:56:43 1984
Date-Received: Wed, 21-Nov-84 00:15:31 EST
Sender: yenbut@uw-beave
Organization: U of Washington Computer Science
Lines: 40

From: [email protected] (Andrew Singer)
MacPascal uses the standard ToolBox Scrap Manager to maintain the Clipboard.
All the information you need (and more than you probably want) is contained in the
Scrap Manager section of Inside Macintosh. The following sample program shows how
to read the contents of the Clipboard if it contains text. If you want to read
picture information out of the Clipboard, you're on your own...

program ReadClipboard;
const
GetScrap = $A9FD;
type
Buffer = packed array[0..32767] of Char;
BufferPtr = ^Buffer;
BufferHandle = ^BufferPtr;
var
theBuffer : BufferHandle;
Offset, BufferLength : Longint;
Index : Integer;
TypeRec : record
theType : packed array[1..4] of Char
end;
begin
theBuffer := NewHandle(0);
TypeRec.theType := 'TEXT';
BufferLength := LInLineF(GetScrap, theBuffer, TypeRec, @Offset);
if BufferLength < 0 then
if BufferLength = -102 then
writeln('*** Clipboard empty or does not contain text')
else
writeln('*** Error #', BufferLength : 1)
else
begin
for Index := 0 to BufferLength - 1 do
write(theBuffer^^[Index]);
end;
DisposeHandle(theBuffer)
end.

Jon F. Hueras, Think Technologies, Inc.
(singer@harvard)