|
Custom Script: C0020
Overview:
Microsoft Office automatically stores your user
information to the document's properties. For example: You can manually
configure this information in Word 97/2000 by choosing Tools | Options | User
Information. ScriptLogic can automatically populate this information for you,
based on the user logging on to the machine.
This custom script is compatible with Office 97
(8.0) and Office 2000 (9.0) and should only be used on US-English versions of
NT, 2000, 95 and 98.
Add these line(s) to your Custom Script:
; * Update MS Office 8.0 or 9.0's Common UserInfo [Begin] *
; The MS Word UserInfo is stored in the registry as Unicode.
; This routine basically interleaves the strings with 00's
; simulating the Unicode equivalent of US-English.
; ** Do not use this routine on localized OS versions other than US-English. **
; The User's Full Name will be extracted from UMD.
; The User's (3) Initials will be extracted from UMD's Description Field,
; provided they are preceded with a pound symbol somewhere in the Desccription
; field. Example of Description Field in UMD: [Network Administrator #ABC ]
; The User's Company needs to be supplied on the next line.
$Company='YourCompanyName'
if existkey('$HKCUSM\Office')=0
$x=1
$RegExp=''
while $X<len(''+$Company)+1
$RegExp=$RegExp+dectohex(asc(substr($Company,$x,1)))+'00'
$x=$x+1
loop
$RegExp=$RegExp+'0000'
$RegKey='$HKCUSM\Office\9.0\Common\UserInfo' ; Office 2000
if existkey('$RegKey')=0
$result=writevalue('$RegKey','Company','$RegExp','REG_BINARY')
endif
$RegKey='$HKCUSM\Office\8.0\Common\UserInfo' ; Office 97
if existkey('$RegKey')=0
$result=writevalue('$RegKey','Company','$RegExp','REG_BINARY')
endif
$x=1
$RegExp=''
while $X<len(''+$FullName)+1
$RegExp=$RegExp+dectohex(asc(substr($FullName,$x,1)))+'00'
$x=$x+1
loop
$RegExp=$RegExp+'0000'
$RegKey='$HKCUSM\Office\9.0\Common\UserInfo' ; Office 2000
if existkey('$RegKey')=0
$result=writevalue('$RegKey','UserName','$RegExp','REG_BINARY')
endif
$RegKey='$HKCUSM\Office\8.0\Common\UserInfo' ; Office 97
if existkey('$RegKey')=0
$result=writevalue('$RegKey','UserName','$RegExp','REG_BINARY')
endif
if $Initials
$x=1
$RegExp=''
while $X<len(''+$Initials)+1
$RegExp=$RegExp+dectohex(asc(substr($Initials,$x,1)))+'00'
$x=$x+1
loop
$RegExp=$RegExp+'0000'
$RegKey='$HKCUSM\Office\9.0\Common\UserInfo' ; Office 2000
if existkey('$RegKey')=0
$result=writevalue('$RegKey','UserInitials','$RegExp','REG_BINARY')
endif
$RegKey='$HKCUSM\Office\8.0\Common\UserInfo' ; Office 97
if existkey('$RegKey')=0
$result=writevalue('$RegKey','UserInitials','$RegExp','REG_BINARY')
endif
endif
endif
; * Update MS Office 8.0 or 9.0's Common UserInfo [End] *
Created: 23 October, 1999
Last Revised: 22 July, 2004
|