Hey Guys,

Just a bit of an update on the scripting stuff... The leash has been lifted and I'm have been testing my very limited scripting skills... Not sure this post even has the weight to be in the Advanced Scripting section to be honest...

Anyway.. just thought it maybe helpful to someone else. So here is how far I have got.

Here is the full script:

 Code:
IF INGROUP("Domain Users")

$objSysInfo     = CreateObject("ADSystemInfo")
$strUser 	= $objSysInfo.UserName
$objUser	= GetObject("LDAP://" + $strUser)
 
$strName 	= $objUser.FullName
$strSN 		= $objUser.sn
$strmobile 	= $objUser.mobile
$strTitle 	= $objUser.Title
$strDepartment 	= $objUser.Department
$strCompany 	= $objUser.Company
$strPhone 	= $objUser.telephoneNumber
$strGivenName 	= $objUser.givenname
$strMail 	= $objUser.mail
$strFax		= $objuser.facsimileTelephoneNumber
$strWeb		= $objUser.wWWHomePage
 
$objWord 	= CreateObject("Word.Application")
 
$objDoc 	= $objWord.Documents.Add()
$objSelection = $objWord.Selection
 
$objEmailOptions = $objWord.EmailOptions
$objSignatureObject = $objEmailOptions.EmailSignature
$objSignatureEntries = $objSignatureObject.EmailSignatureEntries

$objSelection.Font.Name = "Arial" 
$objSelection.Font.Size = "12"
$objSelection.Font.Color = "8421504"
$objSelection.Font.Bold = "1"
$objSelection.TypeText($strGivenName + " " + $strSN)

$objSelection.Font.Name = "Arial" 
$objSelection.Font.Size = "12"
$objSelection.Font.Color = "8421504"
$objSelection.Font.Bold = "0"
$objSelection.TypeText(Chr(11))
$objSelection.TypeText($strTitle)

$objSelection.TypeText(Chr(11))
$objSelection.TypeText(Chr(11))

$objSelection.Font.Name = "Arial" 
$objSelection.Font.Size = "14"
$objSelection.Font.Color = "8421504"
$objSelection.Font.Bold = "0"
$objSelection.TypeText(Company)
$objSelection.TypeText(Chr(11))


$objSelection.Font.Name = "Arial"
$objSelection.Font.Size = "7.5"
$objSelection.Font.Color = "8421504"
$objSelection.Font.Bold = "0"
$objSelection.TypeText("Design  Architecture  Masterplanning  Interiors  Graphics")
$objSelection.TypeText(Chr(11))

$objSelection.TypeText(Chr(11))

$objSelection.Font.Name = "Arial"
$objSelection.Font.Size = "8"
$objSelection.Font.Color = "8421504"
$objSelection.Font.Bold = "0"
$objSelection.TypeText("Winner - Queen's Award for Enterprise: International Trade 2008")
$objSelection.TypeText(Chr(11))
$objSelection.TypeText(Chr(11))


$objSelection.TypeText("T: " + $strPhone)
$objSelection.TypeText(Chr(11))


$objSelection.TypeText("F: " + $strfax)
$objSelection.TypeText(Chr(11))
$objSelection.TypeText(Chr(11))


$objSelection.TypeText($strWeb)
$objSelection.TypeText(Chr(11))
$objSelection.TypeText(Chr(11))


;adds the tree webding to the signature
$objSelection.Font.Name = "Webdings"
$objSelection.Font.Size = "18"
$objSelection.Font.Color = "13421619"
$objSelection.Font.Bold = "1"
$objSelection.Font.Italic = "1"
$objSelection.TypeText("P")


$objSelection.Font.Name = "Arial"
$objSelection.Font.Size = "8"
$objSelection.Font.Color = "13421619"
$objSelection.Font.Bold = "0"
$objSelection.Font.Italic = "0"
$objSelection.TypeText("   Please consider the environment - only print this e-mail if absolutely necessary")

$objSelection = $objDoc.Range()
 
;this specifies what the signature is the be called and whether you want it to apply to forward and reply etc
$objSignature=$objSignatureEntries.Add("default", $objSelection)
$objSignatureObject.NewMessageSignature = "default"
$objSignatureObject.ReplyMessageSignature = "default"
 
$objDoc.Saved = 1
$objWord.Quit

ENDIF


(then there is a code to run our network drives, which always worked ok...)

 Code:
IF INGROUP("EMAIL IMAGE")

CALL "email_image.kix"

CLS


The top part of the code creates the default company email signature for all users, and it works on XP Pro, Windows 7 and Office 2003 and Office 2010.

the 2nd part calls another kix script that incororates an image based on groups...

It is working fine for what we need to do and will mean we no longer have to visit each machine anymore... so all is well with the world. So all my hard work and the boss will probably take all the credit as always... lol.

Couldnt have done it without your help guys, thanks...


Edited by Mart (2011-01-12 04:17 PM)
Edit Reason: Please use code tags when posting code.