set-browser-path
[1/3] from: info:id-net:ch at: 23-Jul-2003 16:40
Hello
Can Someone Use set-browser-path with cmd.exe and passing some args to
cmd.exe ?
I can't. Here's what i tried :
set-browser-path %cmd.exe
browse "/c cd../&&dir *.* >directory.txt" ... doesn't work
[2/3] from: bry::itnisk::com at: 24-Jul-2003 10:20
Well this sort of dovetails nicely with the article I'm writing and
should be done with and have submitted on Friday, don't know when it
will be published but it's for DevX. Anyway it's on asynchronous
pluggable protocols
http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/p
luggable/pluggable.asp you might get the opinion from reading all this
that you need to implement a bunch of interfaces for urlmon.dll to
communicate properly with your protocol, but that is incorrect as shown
here
http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/p
luggable/overview/appendix_a.asp all you need to do is to have an .exe
referenced in the command line, because you only need to call a valid
.exe you can in fact call certain types of exes and load files to it
dynamically I'm providing two examples in the article, one simple one
that calls wscript.exe and loads a simple javascript, if you'll look at
the following exported registry settings:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\ws-proto]
@="\"URL: ws-proto Protocol\""
URL Protocol
=""
[HKEY_CLASSES_ROOT\ws-proto\shell]
[HKEY_CLASSES_ROOT\ws-proto\shell\open]
[HKEY_CLASSES_ROOT\ws-proto\shell\open\command]
@="wscript.exe c:\\wsproto.js %1"
you'll see how this works, wscript.exe imports wsproto.js and passes it
the command line received (the url), wsproto.js could then strip out the
commands received and pass it to the command line. The protocol can then
be accessed via Rebol's browse function as in:
browse ws-proto://commands
note that Rebol's understanding of a protocol doesn't allow for spaces,
so to allow commands to be passed with spaces in them you would have
specify to-url first before you browsed it. There can also be encoding
problems, or so I've seen when I've passed stuff to javascript:
Note also that one has to go through the stripping out of the url body
because what would get passed to wsproto.js would be the whole of the
url, i.e ws-proto://commands this also explains why you unfortunately
cannot use this method to call cmd.exe directly.
[3/3] from: bry:itnisk at: 24-Jul-2003 13:24
As an addendum to what was said earlier, if you have the following:
Jslink: {javascript:alert("hi");}
browse to-url Jslink
then this will open your default javascript protocol handler and present
an alert with the text "hi" in it.
I tried to get the same thing to work with browsing the file:\\\
protocol to cmd.exe but unfortunately that attempts to download it, so
basically the only solution that I can think of, unless you have a
version of Rebol with command capabilities is to do your own pluggable
protocol that passes the stuff onto cmd from there. Not difficult if you
follow what I said earlier however.