Hi guys,

I'm very new to Kix, and have been asked to write a script that amends the user information in word using the @fullname function. Now, I have a script (which I'll attach at the end of this posting), that works, but the company I work for have 3 parts to the full name (firstname, lastname and company name). The script reads the company name as the last name, but I obviously need the actual last name. Can anyone help me ?


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;'start of script [OfficeInfo_Reg.Kix]';
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$A = len(@fullname)

$B = 1

while $B < $A+1

$result = DecToHex (Asc(Substr(UCase(@fullname),$B,1)))

if $result = "20"
$incount = ($B*4)+1
endif

$hexstring = $hexstring + $result + "00"

$B = $B + 1

$C = $hexstring+"0000"

$Myarray = Split("@fullname"," ")
For Each $Element In $MyArray
? $Element
Next

$initials = Substr($C,1,4)+Substr($C,$incount,8)+"0000"

$RC=WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\UserInfo", "UserName", $C, "REG_BINARY")
$RC=WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\UserInfo", "UserInitials", $initials, "REG_BINARY")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;'End of script [OfficeInfo_Reg.kix]';
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;