just started checking your code and it seems to be just a simple syntax error.
in your function change the line:
$n=WriteValue($sub,$name,$val,$dtype)

to:
$n=WriteValue($sub,$name,$value,$dtype)

[Razz]
_________________________
!

download KiXnet