Need help with Clipboard... lazarus / 31-LCL ---------------------------------------------------------------------- cdbc · 2021-02-14 13:10 Hi I need somebody to tell me where i'm stupid  I've got this code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TTokenManager.InsertIntoClipboard(const aToken: string): boolean;begin  Result:= false;  { clipboard.asstring calls clear }  {$ifdef debug}    writeln('aToken -> ',aToken);  {$endif}  Clipboard.AsText:= aToken; // this is the culprit  Result:= true;end;  debug is on. Should be a breeze right, but not quite, i get this error: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Exception at 000000000049B2D2: EAccessViolation:Access violation. in: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Clipboard.AsText:= aToken; // this is the culpritI know i'm an idiot, but what am i doing wrong??? The aToken is a valid github token. Need help please. Regards Benny ---------------------------------------------------------------------- cdbc · 2021-02-14 15:45 Hi jamie 1) Fpc 3.2.0, laz 2.0.10, kde on pclinuxos 2) It's a console app / TCustomApplication descendant 3) Everything else works fine If you can compile and run it, then what gives ?!? It seems easy peasy... Regards Benny ---------------------------------------------------------------------- cdbc · 2021-02-15 13:14 Hi jamie It works fine in kde gui, just not in console  Me thinks it needs some more investigating  Regards Benny ---------------------------------------------------------------------- lucamar · 2021-02-15 18:14 The clipboard is a facility of the Window manager and, IIRC, console applications don't have access to it ... at least not as easily as GUI programs which use the Clipbrd unit, as you're trying to do. ---------------------------------------------------------------------- winni · 2021-02-15 19:05 Hi! You need the unit Interfaces anyway. I made a little demo for the console. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i program clip; {$mode objfpc}{$H+} uses   clipbrd,   Interfaces;  var ch : char;    s: String;begin  repeat   writeln ('select');   Writeln ( 'S)  sent to ClipBoard');   writeln ( 'R)  read from ClipBoard');   writeln ( 'Esc to exit');   write ('-->'); readln(ch);   ch := upcase(ch);   if ch='R' then     begin     s:= Clipboard.AsText;     writeln('Clipboard:');     writeln(s);     writeln('-----------');   end;     if ch = 'S' then     begin     write('Enter text: ');     readln(s);     Clipboard.AsText := s;     writeln ('Sent to ClipBoard');     writeln('-----------');     end;until ch = chr(27); end. Winni ---------------------------------------------------------------------- cdbc · 2021-02-16 12:49 Hi winni Cool, thank you very much  Just what i needed. Regards Benny