rebol protocol
[1/9] from: bry:itnisk at: 12-Dec-2002 18:40
I don't know of how much interest the following will be to the list, if
any, but I was thinking about it today:
If you add the following to your windows registry:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\reb]
@="\"URL:Reb Protocol\""
URL Protocol
=""
[HKEY_CLASSES_ROOT\reb\shell]
[HKEY_CLASSES_ROOT\reb\shell\open]
[HKEY_CLASSES_ROOT\reb\shell\open\command]
@="c:\\rebol\\view\\rebol.exe test.r %1"
then whenever you run reb:c:\some.r from your address bar this would, if
your rebol.exe was located at c:\rebol\view as mine is, load test.r into
rebol.exe and pass it the commandline argument ["reb:c:\some.r"]
I'm wondering what kind of cool things test.r could be made to do.
Note that this will also take a "querystring" so that the following:
reb:c:\some.r?mydoc=some.xml
Will give you the following argument:
["reb:c:\some.r?mydoc=some.xml"]
anyway I found it interesting, hoping someone else does and sparks some
cool ideas (if this hasn't ever been discussed here before).
[2/9] from: greggirwin:mindspring at: 12-Dec-2002 12:11
Hi bryan,
b> anyway I found it interesting, hoping someone else does and sparks some
b> cool ideas (if this hasn't ever been discussed here before).
If you then use BROWSE from a REBOL script, does that work?
E.g. browse reb:c:\some.r?mydoc=some.xml
-- Gregg
[3/9] from: chalz:earthlink at: 12-Dec-2002 18:27
I like this! I have a couple questions regarding it, though.
Like, does this mean if we did something like:
reb://www.somesite.com/rebsite/index.r
it will load their Rebsite index in View?
Also, I'm relatively unskilled in regedit.
> [HKEY_CLASSES_ROOT\reb]
> @="\"URL:Reb Protocol\""
> "URL Protocol"=""
I know how to get to that point and could add the 'reb' group and all.
What's the ['--'] symbol all about?
Also, I've got HKEY_CLASSES_ROOT\REBOL.Script which I used the File Types
dialog to add, and I double-click for /Core, or I can right-click and select
/View, Edit or Edit in NoteTab (my current fave non-Notepad editor). Does this
mean basically the same thing? Should I just add a few keys to my
\REBOL.Script group, or would that mean I'd have to enter "rebol.script:..." to
execute?
> [HKEY_CLASSES_ROOT\reb\shell\open\command]
> @="c:\\rebol\\view\\rebol.exe test.r %1"
What's the test.r for? hmm.. I don't have \open but I have \Core, which
I've set as Default for execution, which is "E:\...\rebol.exe -q "%1""
(obviously not the path ...; just shorter).
> then whenever you run reb:c:\some.r from your address bar this would, if
> your rebol.exe was located at c:\rebol\view as mine is, load test.r into
> rebol.exe and pass it the commandline argument ["reb:c:\some.r"]
Not reb:// ...?
> I'm wondering what kind of cool things test.r could be made to do.
I'm wondering why it's included at all? I don't understand it.
Thanks!
--Charles
[4/9] from: anton:lexicon at: 13-Dec-2002 17:19
What arguments do you get in the script
when you copy a file to a reb:c:\some.r ?
ie. some.r should contain:
print ["soa:" mold system/options/args]
print ["ssa:" mold system/script/args]
Anton.
[5/9] from: bry:itnisk at: 13-Dec-2002 10:07
I haven't taken this any further yet, we're moving today so I probably
won't have time to, and the reason why I'm working with this has nothing
to do with Rebol, but since I have rebol in the back of my mind a lot
lately when I started working with it I naturally thought it would be
cool for Rebol.
What's going on is that reb:c:\some.r won't load straight in rebol.exe,
am uncertain why this should be since other exe's can be passed stuff
this way.
There's sure to be some underlying logic why this is, I have some ideas
but don't want to express them yet as they are somewhat vague and
undeveloped.
This is why I have the test.r, so that rebol.exe loads test.r and test.r
would then have code to interpret the argument which was passed it.
For example if I have a link in a html page, like the following:
<a href="reb:test this">test</a> then test.r receives the following
commandline ["reb:test" "this"]
one could obviously have a number of protocols, rebsite: which would
take the argument and go to the index.r in View.
reb-blocks: which would be used for passing in a block.
And so forth.
If you copy the following into a text file and save it with the .reg
extension and click on it, it will add the proper stuff to your
registry, you get the same stuff if you save export a registry key, for
example look at the key nntp under HKEY_CLASS_ROOT/nntp, this tells
windows how to handle the nntp protocol:
This as a .reg file will add to the registry.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\reb]
@="\"URL:Reb Protocol\""
URL Protocol
=""
[HKEY_CLASSES_ROOT\reb\shell]
[HKEY_CLASSES_ROOT\reb\shell\open]
[HKEY_CLASSES_ROOT\reb\shell\open\command]
@="c:\\rebol\\view\\rebol.exe test.r %1"
as a general rule it's not considered good to use reg files anymore as
they have no logic in them, so one should use wscript, but as I know
what it is I want to do I'll just use the .reg file.
Another interesting thing, in light of the stuff Rebol is especially
good at if you look at HKEY_CLASS_ROOT/mailto this is what handles the
mailto protocol.
The @ is what puts it into the Default value.
The protocol accepts reb:
Reb:// will also be accepted of course as reb:// is contained in reb:
right?
Am uncertain exactly why this is, suppose it has to do with some weird
thing in Urlmon.dll but don't intend to go look right now.
About the question of using browse:
If I use browse "reb:test this" I get ["reb://test" "this/"], if I use
browse reb://c:\some.r?query=some.xml I get
["reb://c:\some.r/?query=some.xml"] as my commandline argument
This seems good to me.
[6/9] from: bry:itnisk at: 13-Dec-2002 13:30
>What's going on is that reb:c:\some.r won't load straight in rebol.exe,
>am uncertain why this should be since other exe's can be passed stuff
>this way.
>There's sure to be some underlying logic why this is, I have some ideas
>but don't want to express them yet as they are somewhat vague and
>undeveloped.
It's as I thought, the command key in the registry indicates that
something is to be opened via the commandline. Most protocols are
interpreted via command but there are other ways, as well as
complementary ways, basically you can pass various verbs (as in shell
verbs) via the protocol by having a DDEEXEC key under the registry. As a
general rule ddeexec is used for files and not for protocols but in fact
a ddeexec key can be used with a protocol and the protocol can thereby
have verbs associated with it just as you would have with a file (Open
is a common verb that you will find when you right click, just in case
anyone is not familiar with the windows shell).
If one looks at HKEY_CLASSES_ROOT\mhtmlfile then there's an example of
using this key.
A ddeexec key tells the shell how to process Dynamic Data Exchange
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/w
inui/windowsuserinterface/dataexchange/dynamicdataexchange.asp
here's a technical article on DDE
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndynex
/html/msdn_ddeexec.asp
Am personally not to familiar with the subject of DDE it being lower
level than I like to go.
The question would be if Rebol has the possibility of running a DDE
conversation?
If so the three keys under ddeexec would be:
Application
Set the default value of this subkey to the application name to be used
to establish the DDE conversation. If there is no application subkey,
the default value of the verb's command subkey is used as the
application name.
Topic
Set the default value of this subkey to the topic name of the DDE
conversation. If there is no topic subkey, System is used as the topic
name.
ifexec
Set the default value of this subkey to the DDE command to be used if
DDE conversation cannot be initiated. When initiation fails, the
application specified by the default value of the verb's command subkey
is launched. If an ifexec key exists, its default value will then be
used as the DDE command. If there is no ifexec subkey, the default value
of the ddeexec key will be used again as the DDE command.
[7/9] from: bry:itnisk at: 13-Dec-2002 13:57
>What's going on is that reb:c:\some.r won't load straight in rebol.exe,
>am uncertain why this should be since other exe's can be passed stuff
>this way.
>There's sure to be some underlying logic why this is, I have some ideas
>but don't want to express them yet as they are somewhat vague and
>undeveloped.
The command line from the Rebol.Script key works:
c:\rebol\view\rebol.exe
-q "%1" except of course that the filepath is
improper, I suppose there must be some way that I can tell Rebol to
parse out a reb: or reb:// when a command line request is received?
[8/9] from: greggirwin::mindspring::com at: 13-Dec-2002 11:24
Hi Bryan,
b> Am personally not to familiar with the subject of DDE it being lower
b> level than I like to go.
b> The question would be if Rebol has the possibility of running a DDE
b> conversation?
I haven't done DDE stuff in a number of years, and don't really want
to again. :) I.e. even if REBOL can do it, I don't know if it's worth
it.
-- Gregg
[9/9] from: chalz:earthlink at: 13-Dec-2002 18:18
> If you copy the following into a text file and save it with the .reg
> extension and click on it, it will add the proper stuff to your
Gotcha. Okay, I know how to do that much. *grins* Thanks :)
> as a general rule it's not considered good to use reg files anymore as
> they have no logic in them, so one should use wscript, but as I know
> what it is I want to do I'll just use the .reg file.
Uh, okay. And that's easier for me to understand, I think ;) I don't know
if I've got Windows Scripting Host installed anyways, if that's what's required
for wscript...
Well, no worries. If I get confused, I'll just ask for verification :)
--Charles