To save hassle, manually create key path and dummy default value
  HKCR\*\shell\Open with Notepad\command\
if it doesn't already exist

(You can create keys, but only one level at a time.  Not worth the coding).

First export key in question in regedit, also do a system restore point in case 
you do anything disastrous.

--- In [email protected], Brother Gabriel-Marie <brgabr...@...> wrote:
>
> Hello all!  I sent this in a week or so ago but noone said anything, and 
> I am hoping someone could take a quick look for me and get me started.  
> Basically, I just need a sample on how to create/edit/delete registry 
> keys.  Thanks!

function Notepad(how)
static originalvalue 
local sPath = ?"HKEY_CLASSES_ROOT\*\shell\Open with Notepad\command\"
;or
local sPath = ?"HKCR\*\shell\Open with Notepad\command\"
;notice final \, meaning get default value
;am I right to think that "static" will hold the value in memory
;until PP exits? YES

if ( originalvalue == "")
  originalvalue = reg.get_value(sPath)

If (how == 0) or (how =="") do ;;install key
;CREATE THIS KEY
  reg.set_string(sPath , "notepad.exe %1")

ElseIf (how == 1)do ;;remove key

  reg.set_string(sPath , "")

ElseIf (how == 2) do ;;restore original value

  reg.set_string(sPath , originalvalue)

ElseIf (how == 3) do ;;change from Notepad to Notepad2
[change existing key value from @="notepad.exe %1" to

  reg.set_string(sPath , ?"C:\Program Files\notepad2\notepad2.exe %1")

EndIf
quit


Reply via email to