The line:
$windir=READVALUE($machinewinkey+' NT\CurrentVersion','SystemRoot')

does not work either as $machinewinkey is not defined. You should SetOption('Explicit','On') to ferret out missing var definitions.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.