Sorry about jumping in a little late in the game..

You are missing $userwinkey and $machinewinkey.
Code:

$userwinkey='HKCU\Software\Microsoft\Windows'
$machinewinkey='HKLM\Software\Microsoft\Windows'



Add this above -
Code:

IF @inwin=1
$profilelocation=$userwinkey+' NT\CurrentVersion\Windows Messaging Subsystem\Profiles'
$windir=READVALUE($machinewinkey+' NT\CurrentVersion','SystemRoot')
ENDIF



HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's