@wp: it is possible to use
Clipboard object in console application.
First of all, we need to add
LCL package in
Project Inspector window (node
Required Packages), to get the access to the
Clipboard object. Then we need to add
Clipbrd to the uses list:
program ClipboardTest;
{$MODE OBJFPC}{$LONGSTRINGS ON}
uses
Clipbrd;
begin
Write('Clipboard content: ', Clipboard.AsText);
end.
Boom, exception –
TClipboard use a widgetset, so it must be created. This is done in the
initialization section of the unit
Interfaces, so we need to add this unit to the list (as first):
program ClipboardTest;
{$MODE OBJFPC}{$LONGSTRINGS ON}
uses
Interfaces, Clipbrd;
begin
Write('Clipboard content: ', Clipboard.AsText);
end.
Works correctly for me (at least on the
Windows).