Hi all,

Here is something I'd like to share with you. I've been building a 
lightweight local portal page, from which I wanted (among others) to run 
some local applications, and PP seemed a nice glue language. After some 
experimentation with [1] & [2], I've found the solution here [3]. 
Basically you register a new protocol handler, e.g. "powerpro://" and 
pass parameters to it.

To do this you have to save this text to a .reg file and merge it:

--- CUT ---
[HKEY_CLASSES_ROOT\powerpro]
@="\"URL:powerpro custom protocol\""
"URL Protocol"=""

[HKEY_CLASSES_ROOT\powerpro\shell]

[HKEY_CLASSES_ROOT\powerpro\shell\open]

[HKEY_CLASSES_ROOT\powerpro\shell\open\command]
@="path_to_powerpro.exe .powerpro_hand...@entry_point(\"%1\")"
--- CUT ---
(unfortunately REG_EXPAND_SZ-type did not work for me)


Then you just use in your .html file a link like this:
--- CUT ---
<a href="powerpro://hello world@ foo/bar">Test my protocol</a>
<a href="powerpro:or without leading slashes/">Test my protocol</a>
--- CUT ---


And finally, your script could look like this; save it to a file 
"powerpro_handler.powerpro" and put to PP-Scripts folder:
--- CUT ---
@entry_point
     Args pParam
     // get rid of leading protocol and/or trailing slashes
     local _pos = find(pParam, ":")
     if(_pos != -1)
         pParam = pParam.remove(_pos + 1)
     if(pParam.slice(2) == ?"//")
         pParam = pParam.remove(2)
     if(pParam.revfind("/") == length(pParam)-1)
         pParam = remove(pParam, -1)
     pParam = replaceg(pParam, ?"%20", " ")
     win.debug("param: ("++pParam++")")
     // do whatever you like
     Quit
--- CUT ---

I've tested this only with Firefox 3.5, IE6 & Opera 9. Other browsers 
might or might not work. With POW [2] you have much more possibilities 
than just launching PP scripts, though it is a bit heavier on mem-usage.

Hope this helps someone,
Cüneyt


[1] http://bushwhacker.seesaa.net/article/16861899.html
[2] http://davidkellogg.com/wiki/Main_Page
[3] http://reboltutorial.com/blog/dzone-protocol/

Reply via email to