SRL Archive - OSR Help

how to obtain text from clipboard?


eska

2012-07-06 19:38:22

Alright so I'm making a script for another game and I need to be able to read what is in the clipboard to modify the behavior of my script on the fly.

The clipboard is the place where your "Ctrl + C" save the text so that you can later paste it.

I found this thread and they show a a way to do it with an invisible form, but it is not working for me and I don't understand what isn't working:
http://villavu.com/forum/showthread.php?t=44203&highlight=clipboard

The suggested code:
program CopyPasta;
var
F: TForm;
E: TEdit;

procedure InitForm;
begin
F:= CreateForm;
E:= TEdit.Create(F);
with E do
begin
Parent:= F;
PasteFromClipboard;
Writeln(Text);
end;
end;

procedure SafeInitForm;
var
V: TVariantArray;
begin
V:= [];
ThreadSafeCall('InitForm', V);
end;

begin
SafeInitForm;
end.

So my question is, how can I get this to work? Thanks.

Brandon

2012-07-06 19:56:35


begin
SetClipBoard('Brandon'); //Changes the text in the clipboard..

writeln(GetClipBoard); //Gets the text from the clipboard.
end.

eska

2012-07-06 20:05:01

Wow it's much simplier now. looks like I was searching for something hard when the answer was that simple. Works perfectly.

Thanks brandon.