[REBOL] A Rebol plug-in
From: inetw3::mindspring::com at: 28-Oct-2002 9:50
Hello Rebolers,
If you could be so nice to try this code for me, and
tell me if it works for you. thank you.
Sorry, this only work in IE (i think Nscape/Mozilla
can play with the clipboard also, i lost the code.)
put this in a web page. be sure to save all in a view folder
=========================================
<SCRIPT>
function Rquery() { window.clipboardData.setData('Text',
event.srcElement.outerHTML); }
function read()
{
r=document.all.RData.createTextRange();
r.execCommand("paste");
}
setInterval("read()",1000);
</SCRIPT>
</HEAD>
<BODY>
<FORM action="clipboardDatascript.r"/">
NAME:<input onBlur="Rquery()" ID:"name" type="text"> </input><br>
ADDR: <input onBlur="Rquery()" ID:"addr" type="text" ></input><br>
AGE: <input onBlur="Rquery()" ID:"age"
type="text"></input>
<input type="submit" value="Go"></FORM>
<br>
<TEXTAREA NAME="RData" ID:"OUT" ROWS="5" COLS="35" READONLY="TRUE"
style="border:none;toolbar:none;"></TEXTAREA>
=========================================
put this in view folder as your %clipboardDatascript.r
you can use switch instead of either/parse coding.
this is just a demo. you can use this so people can
do your code in and out of the browser from a web
page or browser DOM updates.
(dynamic message object is rquery-rdata-%clipboard_script.r
and (un)shared clipboard through tcp://localhost:8001 code)
=========================================
Rquery: func [data][write clipboard:// data]
Rdata: does [read clipboard://]
sNAME: 'hello
saddr: {your address is: }
sage_: {and your}
s_age: {yeas old}
listen: open tcp://:8001 {you don't need tcp stuff for this demo}
remote: open tcp://localhost:8001
local: first listen
either find Rdata "id:?addr?" [parse Rdata [thru "value=" copy addr to
id:?addr?
(send: probe reform [saddr addr] insert local Rquery send)]] [""]
either find Rdata "id:?NAME?" [parse Rdata [thru "value=" copy name to
ID:?NAME?
(send: probe reform [sNAME NAME] insert local Rquery send)]] [""]
either find Rdata "id:?AGE?" [parse Rdata [thru "value=" copy age to
ID:?AGE?
(send: probe reform [sage_ AGE s_age] insert local Rquery send)]]
[""]
close local
close remote
close listen
forever [do %user.r[wait 3]]
===========================================
put this in your %user.r file
===========================================
THIS: does[read clipboard://]
if find this "ID" [forever [do %clipboardDatascript.r[wait 3]]]
(use either instead of if, this is just a demo)
===========================================
this code is just a thought i had out loud.
improve it and you'll get your rebol plug-in for
IE and maybe NSwhen i find there clipboard code.
Anyone who can make this thing better,faster, and
as an object,let me know.