A Rebol plug-in
[1/3] 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.
[2/3] from: anton:lexicon at: 30-Oct-2002 1:09
I tried the scripts and they pass the three
types of message from IE 5.00 to
REBOL/View 1.2.8.3.1 3-Aug-2002 (beta).
But I get the File Download popup each time I
press "Go" on the web page:
You have chosen to download a file from this location.
clipboardDatascript.r from D:\Anton\Dev\Rebol\View
What would you like to do with this file?
* Open the file from its current location
* Save the file to disk
[/] Always ask before opening this type of file
Even if I untick the "Always ask..." option, it
pops up the above window. But the messages are
passed from IE to rebol "hello anton",
your address is ...
etc. if I only click in
an input text, then unfocus from it by clicking
on the page background or another input text.
After doing this I see the messages appear in
the rebol console.
Anton.
--- iNetW3 wrote: ---
[3/3] from: dmurrill:mindspring at: 29-Oct-2002 23:00
Hello Anton,
Thanks for the feedback.
The go button's really suppose to be a link
to force the rebol console to open, move that
aside.
The download dialogue pops up for anything
other than some activex, and java applet
controls, but it should close out. If it doesn't,
In the browser bar click Tools--Internet Options--Security--
Run Activex controls & plug-ins, set this to ENABLE.
Make sure rebol rebol.exe beta is associated to open
%rebol.r files in your windows folder options.
If this doesn't work, let me know please.
As you move from an input text to input text,
the "Hello Anton" etc. should be seen in the
webpage. This can be changed, you have to change
your action method (onfocus,onmouseout,onclick,etc.)
I'm using Rebol/View 1.1, but this shouldn't
make a difference in the clipboard.
This should work somewhat like MS ASP, you can replace
anything in the page or email the info directly back
to you.
make sure if you run rebol from an editor
or anything else you copied something else to
the clipboard or you'll get an error or your
clipboard code will execute.