Problem with your code?I don't even see you using readtype. Instead I see you using readvalue= and then plugging in the result of that into the RegType when Writing the value...
Maybe you mean this:
$regtype=ReadType($ikey, $ikey_ex)
WriteValue($ikey, $ikey_ex, "QuickView with Notepad", $regtype)
-Stephen