The read from clipboard value can be used to get a string or an image from the clipboard
By default a string is expected. To get an image, select the read image from clipboard option. This will result in a binary variable.
Activity properties
begin var ClipBoardImage: ICodolexBinary; var ClipBoard := TClipBoard.Create; try ClipBoard.Open;
var Image := TImage.Create(nil); var MemoryStream := TMemoryStream.Create; try ClipBoardImage := TCodolexBinary.Create; var Picture := Image.Picture; if ClipBoard.HasFormat(CF_PICTURE) then begin Picture.Assign(ClipBoard); Picture.SaveToStream(MemoryStream); ClipBoardImage.Stream.LoadFromStream(MemoryStream); end else if ClipBoard.HasFormat(CF_BITMAP) then begin var BitMap := Picture.BitMap; BitMap.Assign(ClipBoard); BitMap.SaveToStream(MemoryStream); ClipBoardImage.Stream.LoadFromStream(MemoryStream); end; finally Image.Free; MemoryStream.Free; end; finally ClipBoard.Close; ClipBoard.Free; end; end; |