[THIN] Re: User information in office

  • From: "Mack, Rick" <RMack@xxxxxxxxxxxxxx>
  • To: "'thin@xxxxxxxxxxxxx'" <thin@xxxxxxxxxxxxx>
  • Date: Thu, 5 Feb 2004 11:11:51 +1100

Hi,
 
This'll do the username with kix.
----------
; first determine length of string
 
$lenstr=len("@fullname")
$unistring=""
$offset=0
 
; now convert the characters to unicode
 
while $offset<>$lenstr 
 $Offset=$offset+1
 $chr=dectohex(asc(substr(@fullname,$offset,1)))
 $unistring=$unistring +$chr+"00"
loop
 
$unistring=$unistring +"0000"
 

$regloc="HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common\UserInfo"
$result=writevalue($regloc,"UserName",$unistring,"REG_BINARY")
---------------
 
Addinig initial is pretty easy as well, eg.
---------------
; now convert the Fullname to Initials
 
$delimitr = " "
$offseta = len(@fullname)
$offsetb = instr(@fullname,$delimitr)
$fname  = substr(@fullname,1,$offsetb-1)
$lname  = substr(@fullname,$offsetb+1,($offseta-$offsetb))
$inits  = substr($fname,1,1) + substr($lname,1,1)
----------------
 
followed by another unicode conversion.
 
regards,
 
Rick

Ulrich Mack
 <mailto:rmack@xxxxxxxxxxxxxx> rmack@xxxxxxxxxxxxxx 
Volante Systems
18 Heussler Terrace, Milton 4064 
Queensland Australia. 
tel +61 7 3246 7704 



Other related posts: