#201001 - 2010-12-03 02:19 PM
Outlook Signature... conversion...
|
pink_stig
Fresh Scripter
Registered: 2010-09-01
Posts: 10
Loc: Lincoln
|
Hi Guys,
I was wondering if you could help me.... My boss has very kindly sent me a file he created for out new email signatures in Outlook 2003. He wants me to roll this out using kix and I believe we need to convert this or call it as a seperate file.
Can anyone point me in the right direction, I'm not very good a scripting though :o/
Here is the text below he wants me to roll out using kix...
Set objLDAPUser = GetObject("LDAP://" & GetUserDN(userName,domainName))
'Prepare to create some files Dim objFSO, objWsh, appDataPath, pathToCopyTo, plainTextFile, plainTextFilePath, richTextFile, richTextFilePath, htmlFile, htmlFilePath Set objFSO = CreateObject("Scripting.FileSystemObject") Set objWsh = CreateObject("WScript.Shell") appDataPath = objWsh.ExpandEnvironmentStrings("%APPDATA%") pathToCopyTo = appDataPath & "\Microsoft\Signatures\"
'And finally, the HTML signature htmlFilePath = pathToCopyTo & "Default.htm" Set htmlFile = objFSO.CreateTextFile(htmlFilePath, TRUE) htmlfile.WriteLine("<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">") htmlfile.WriteLine("<html xmlns=""http://www.w3.org/1999/xhtml"" >") htmlfile.WriteLine("<body>") htmlfile.WriteLine("<div style=""font-size:12pt;font-weight:'700';font-family:'Arial'; color:'gray';"">") htmlfile.WriteLine("<div>" & objLDAPUser.DisplayName & "</div>") htmlfile.WriteLine("<div style=""font-size:12pt;font-weight:'normal';font-family:'Arial'; color:'gray';"">") htmlfile.WriteLine("<div>" & objLDAPUser.title & "</div>") htmlfile.WriteLine("<span style=""font-size:12pt; font-family:'Arial','helvetica';color:'white';"">BLANKLINE</span><P>") htmlfile.WriteLine("<div style=""font-size:14pt;font-weight:'normal'; font-family:'Arial'; color:'gray';"">") htmlfile.WriteLine("<div>" & objLDAPUser.company & "</div>") htmlfile.WriteLine("<span style=""font-size:7.5pt; font-family:'Arial','helvetica';color:'gray';"">Design Architecture Masterplanning Interiors Graphics</span><P>") htmlfile.WriteLine("<span style=""font-size:8pt; font-family:'Arial','helvetica';color:'gray';"">Winner – Queen’s Award for Enterprise: International Trade 2008 </span>") htmlfile.WriteLine("<div style=""font-size:8pt; font-family:'Arial'; color:'gray';"">") htmlfile.WriteLine("<div>T: " & objLDAPUser.telephoneNumber & "</div>") htmlfile.WriteLine("<div>F: " & objLDAPUser.facsimileTelephoneNumber & "</div>") htmlfile.WriteLine("<span style=""font-size:12pt; font-family:'Arial','helvetica';color:'white';"">BLANKLINE</span><P>") htmlfile.WriteLine("<div style=""font-size:9pt; font-family:'Arial'; color:'gray';"">") htmlfile.WriteLine("<div> <a href=""http://" & objLDAPUser.wWWHomePage & """>" & objLDAPUser.wWWHomePage & "</a></div>") htmlfile.WriteLine("<span style=""font-size:12pt; font-family:'Arial','helvetica';color:'white';"">BLANKLINE</span><P>") htmlfile.WriteLine("</div>") htmlfile.WriteLine("<span style=""font-size:18pt; color:'#33CCCC'; font-family:'Webdings','helvetica';"">P </span><span style=""font-size:7.5pt; font-family:'Arial','helvetica';color:'#33CCCC';"">Please consider the environment before printing this e-mail. </span>") htmlfile.WriteLine("</body>") htmlfile.Write("</html>")
To see if it would work, it was a high hope though, I put this into Kix and I get an error message,
ERROR : error in parameterdefinition of [getuserdn]! Script: T:\bny_email.kix
This is due to the first line of text I know but if anyone can point me in the right direction that would be great. Im not sure how I go about creating a new one from scratch even though I have read the email signature topics in here...
Thanks a lot...
Lara 'A not very good at scripting' IT person...
|
|
Top
|
|
|
|
#201003 - 2010-12-03 06:05 PM
Re: Outlook Signature... conversion...
[Re: Mart]
|
pink_stig
Fresh Scripter
Registered: 2010-09-01
Posts: 10
Loc: Lincoln
|
Thanks for all the help... Here is what I have managed to do so far... It may be a little messy but it has got me lots further than I had ever hoped!!!!
Could you help me hyperlink the website please.... I did try a few thing but it didnt work out...
Thanks,
$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 Name) $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 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))
$objSelection.Font.Name = "Arial" $objSelection.Font.Size = "8" $objSelection.Font.Color = "13421619" $objSelection.Font.Bold = "0" $objSelection.TypeText("Please consider the environment - only print this e-mail if absolutely necessary")
$objSelection = $objDoc.Range()
$objSignature=$objSignatureEntries.Add("Signature", $objSelection) $objSignatureObject.NewMessageSignature = "Signature" $objSignatureObject.ReplyMessageSignature = "Signature" $objDoc.Saved = 1 $objWord.Quit
|
|
Top
|
|
|
|
#201272 - 2010-12-23 12:40 PM
Re: Outlook Signature... conversion...
[Re: Glenn Barnas]
|
pink_stig
Fresh Scripter
Registered: 2010-09-01
Posts: 10
Loc: Lincoln
|
Hey guys, Cheers for the help so far...
The script has been rolled out for testing and works fine on XP machines. Is there something else I need to do to get it to work on Windows 7???
|
|
Top
|
|
|
|
#201286 - 2010-12-23 08:08 PM
Re: Outlook Signature... conversion...
[Re: Glenn Barnas]
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
LOL, I always write my own stuff, never even used one of the UDF's  I'll see what I can submit, I just wrote a LastLogon property script for all PC's in the Domain (querying and evaluating times on ALL DC's).
|
|
Top
|
|
|
|
#201362 - 2011-01-12 03:57 PM
Re: Outlook Signature... conversion...
[Re: Glenn Barnas]
|
pink_stig
Fresh Scripter
Registered: 2010-09-01
Posts: 10
Loc: Lincoln
|
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:
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...)
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.
|
|
Top
|
|
|
|
#201364 - 2011-01-12 04:55 PM
Re: Outlook Signature... conversion...
[Re: Mart]
|
pink_stig
Fresh Scripter
Registered: 2010-09-01
Posts: 10
Loc: Lincoln
|
Ok, thanks for that... I'll give it a go :o)
|
|
Top
|
|
|
|
#201633 - 2011-02-22 10:58 AM
Re: Outlook Signature... conversion...
[Re: pink_stig]
|
pink_stig
Fresh Scripter
Registered: 2010-09-01
Posts: 10
Loc: Lincoln
|
Hey guys,
I am successfully running this script on the network and have now created a group that an email image is applied to through AD Security Groups. The script is executing fine, but it keeps asking used to save over the normal.dot file. Is there anyway to force Word to save it automatically without user intervention?
Here is the text in the file...
$objDoc.Saved = 1 $objWord.Quit
|
|
Top
|
|
|
|
#201846 - 2011-04-04 03:52 PM
Re: Outlook Signature... conversion...
[Re: Mart]
|
pink_stig
Fresh Scripter
Registered: 2010-09-01
Posts: 10
Loc: Lincoln
|
Thanks, I tried to put this in the other kix script that runs but it seems to not be working for a couple of users, I dont have any issues with it on my PC... the kix script that gets called look like this:
;***************************************************************************
;****Add Email Signature using Kix Login
;****
;***************************************************************************
$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
;Check to see if the Word temp file exists.
If Exist($appdata + "\Microsoft\Templates\~$Normal.dot")
;Delete Word temp file.
Del $appdata + "\Microsoft\Templates\~$Normal.dot"
EndIf
$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.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.Size = "14"
$objSelection.Font.Color = "8421504"
$objSelection.Font.Bold = "0"
$objSelection.TypeText(Benoy)
$objSelection.TypeText(Chr(11))
$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.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))
;add the image to the signature
$objShape = $objSelection.InlineShapes.AddPicture("\\servername\NETLOGON\Signature_image\Default\signature_image.gif")
$objLink = $objDoc.Hyperlinks.Add($objShape, "mailto:first.last@@emailaddress.com")
$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("company_image", $objSelection)
$objSignatureObject.NewMessageSignature = "company_image"
$objSignatureObject.ReplyMessageSignature = "company_image"
$objDoc.Saved = 1
$objWord.Quit
Is this correct? I dont need to add this to kix script I use as I dont get the save as problem, it runs fine without it?!? It hasnt made any difference to the guys that are having the issue, or do I need to amend the script slightly?
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 1198 anonymous users online.
|
|
|