#48133 - 1999-09-10 05:21 AM
How to write Office username and Initials with Kixtart
|
Anonymous
Anonymous
Unregistered
|
$counter=1 $Initials="" $x = len (@userid)while $counter =< $x $Y=substr (ucase(@userid),$counter,1) $ascii=asc ($y) $hex=dectohex ($ascii) $counter=$counter+1 ;the spaces are to force at stringcopy. $Initials=" "+$Initials+$hex+"00" loop $Initials=ltrim ($Initials) +"00" +"00" $counter=1 $Name=""
$x = len (@fullname) while $counter =< $x $Y=substr (@fullname,$counter,1) $ascii=asc ($y) $hex=dectohex ($ascii) $counter=$counter+1 $Name=" "+$Name+$hex+"00" loop $Name=ltrim ($Name) +"00" +"00" ;Check the keys for the right version of office Writevalue("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common\UserInfo","UserInitials",$Initials,"reg_binary") Writevalue("HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Common\UserInfo","UserName",$Name,"reg_binary")
|
|
Top
|
|
|
|
#48134 - 2001-02-08 12:11 AM
Re: How to write Office username and Initials with Kixtart
|
Anonymous
Anonymous
Unregistered
|
Great script - thanks!
|
|
Top
|
|
|
|
#48135 - 2001-02-08 12:24 AM
Re: How to write Office username and Initials with Kixtart
|
Anonymous
Anonymous
Unregistered
|
Can anyone find where the Mailing address for word is stored? I'd like to set that too, but I can't find it in Office 2000.It's called UserAddress in Office97, but it's not there in Office 2000
|
|
Top
|
|
|
|
#48136 - 2002-07-08 11:49 PM
Re: How to write Office username and Initials with Kixtart
|
xpanmanx
Starting to like KiXtart
Registered: 2002-07-08
Posts: 108
Loc: St. Louis MO USA
|
code:
Updating this thread with my code for Office XP.
Our AD uses last-name-first fullnames, so there's code in here to "turn around" the user's name.
---------------------------------------------
$comma = instr(@fullname,",") $firstname = ltrim(substr(@fullname,$comma+1,len(@fullname)-$comma)) $middleinitial=("")
if instr(@fullname,".") $middleinitial=ltrim(substr($firstname,len($firstname)-2,2)) endif
$lastname = ltrim(substr(@fullname,1,$comma-1)) $firstnamefirst=$firstname + (" ") + $lastname $firstinitial = ltrim(substr($firstname, 1, 1)) $lastinitial = ltrim(substr($lastname, 1, 1)) $initials=$firstinitial + $middleinitial + $lastinitial
$x=1 $usernamehex='' while $X<len(''+$firstnamefirst)+1 $usernamehex=$usernamehex+dectohex(asc(substr($firstnamefirst,$x,1)))+'00' $x = $x + 1 loop $usernamehex=$usernamehex + '0000'
$x=1 $userinitialshex='' while $X<len(''+$initials)+1 $userinitalshex=$userinitialshex+dectohex(asc(substr($initials,$x,1)))+'00' $x = $x + 1 loop $userinitialshex=$userinitialshex + '0000'
WriteValue ("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Common\UserInfo", "UserName", $usernamehex, "reg_binary") WriteValue ("HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Common\UserInfo", "UserInitials", $userinitialshex, "reg_binary")
|
|
Top
|
|
|
|
#48137 - 2002-07-09 06:39 AM
Re: How to write Office username and Initials with Kixtart
|
xpanmanx
Starting to like KiXtart
Registered: 2002-07-08
Posts: 108
Loc: St. Louis MO USA
|
Then I came up with this code, a doctoring of some from the FAQ section of this BB.
From a first-name-first @fullname, this code splits out first and last names, removes the MI-followed-by-period from the first name (if present) and gets you two or three initials as the result.
code:
$splitbetweennames = instr(@fullname," ")
if instr(@fullname,". ") $splitbetweennames = instr(@fullname,". ") endif
$firstname = substr(@fullname,1,$splitbetweennames)
$firstnametemp = $firstname
if instr(@fullname,". ") $firstnametemp = substr(@fullname,1,len($firstnametemp)-3) endif
? "First name, no MI: " $firstnametemp
$lastname = ltrim(substr(@fullname,$splitbetweennames+1,len(@fullname)-$splitbetweennames))
? "Last name: " + $lastname
$firstinitial = ltrim(substr(@fullname,1,1))
$middleinitial=("")
if instr(@fullname,".") $middleinitial=ltrim(substr($firstname,len($firstname)-2,2)) endif
$lastinitial = ltrim(substr($lastname,1,1))
? "initials: " + $firstinitial + $middleinitial + $lastinitial
|
|
Top
|
|
|
|
#48139 - 2002-07-09 09:01 AM
Re: How to write Office username and Initials with Kixtart
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
In the FAQ Section, there is a topic that covers this, specifically: Initials of a User - String Manipulation
Regards,
Kent
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|