Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - email .sig using vbs - adding an image

Reply
 
Old 07-02-2008   #1 (permalink)
al


 
 

email .sig using vbs - adding an image

Hi there, I found and edited slightly a script that creates a default
outlook signature by pulling in AD info, and adding a text disclaimer. I
need to add an image
(company logo) but dont know how to go about it, please help!! Here is the
script so far;


Set objUser = CreateObject("WScript.Network")
userName = objUser.UserName
domainName = objUser.UserDomain

FUNCTION GetUserDN(BYVAL UN, BYVAL DN)
Set ObjTrans = CreateObject("NameTranslate")
objTrans.init 1, DN
objTrans.set 3, DN & "\" & UN
strUserDN = objTrans.Get(1)
GetUserDN = strUserDN
END FUNCTION

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\"

'Let's create the plain text signature
plainTextFilePath = pathToCopyTo & "Default.txt"
Set plainTextFile = objFSO.CreateTextFile(plainTextFilePath, TRUE)
plainTextFile.WriteLine("-- ")
plainTextFile.WriteLine(objLDAPUser.DisplayName)
plainTextFile.WriteLine(objLDAPUser.title)
plainTextFile.WriteLine(objLDAPUser.company)
plainTextFile.WriteLine("t: " & objLDAPUser.telephoneNumber)
plainTextFile.WriteLine("f: " & objLDAPUser.facsimileTelephoneNumber)
plainTextFile.Write("w: " & objLDAPUser.wWWHomePage)
plainTextFile.Write(" ")
plainTextFile.WriteLine("Streeter Marshall is regulated by the Solicitors
Regulation Authority. A list of the Partners is available from 74 High
Street, Croydon CR9 2UU. Information in this message is confidential and
may be legally privileged. If you are not the intended recipient, please
notify the sender, and please delete the message from your system
immediately.")
plainTextFile.Close

'Now we create the Rich Text signature
richTextFilePath = pathToCopyTo & "Default.rtf"
Set richTextFile = objFSO.CreateTextFile(richTextFilePath, TRUE)
richTextFile.WriteLine("{\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\fswiss\fcharset0
calibri;}}")
richTextFile.WriteLine("\viewkind4\uc1\pard\f0\fs20 \par")
richTextFile.WriteLine ("\b")
richTextFile.WriteLine(objLDAPUser.DisplayName & "\par")
richTextFile.WriteLine ("\b0")
richTextFile.WriteLine(objLDAPUser.title & "\par")
richTextFile.WriteLine ("\line")
richTextFile.WriteLine
("________________________________________________________________________________________________________________________________________________")
richTextFile.WriteLine ("\line")
richTextFile.WriteLine ("\line")
richTextFile.WriteLine(objLDAPUser.company & "\par")
richTextFile.WriteLine (objLDAPUser.streetAddress & "\par")
richTextFile.WriteLine("t: " & objLDAPUser.telephoneNumber & " f: " &
objLDAPUser.facsimileTelephoneNumber & " dx: "& objLDAPUser.postalCode &
"\par")
richTextFile.WriteLine("w: " & objLDAPUser.wWWHomePage & "\par")
richTextFile.WriteLine ("\line")
richTextFile.WriteLine("Streeter Marshall is regulated by the Solicitors
Regulation Authority. A list of the Partners is available from 74 High
Street, Croydon CR9 2UU. Information in this message is confidential and
may be legally privileged. If you are not the intended recipient, please
notify the sender, and please delete the message from your system
immediately.")
richTextFile.Write("}")
richTextFile.Close

'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:10pt; font-family:'Calibri';"">")
htmlfile.WriteLine("<div>-- </div>")
htmlfile.WriteLine("<div>" & objLDAPUser.DisplayName & "</div>")
htmlfile.WriteLine("<div>" & objLDAPUser.title & "</div>")
htmlfile.WriteLine("<div>" & objLDAPUser.company & "</div>")
htmlfile.WriteLine("<div>t: " & objLDAPUser.telephoneNumber & "</div>")
htmlfile.WriteLine("<div>f: " & objLDAPUser.facsimileTelephoneNumber &
"</div>")
htmlfile.WriteLine("<div>w: <a href=""http://" & objLDAPUser.wWWHomePage &
""">" & objLDAPUser.wWWHomePage & "</a></div>")
htmlfile.WriteLine("<h1>testing</h1>")
htmlfile.WriteLine("</div>")
htmlfile.WriteLine("</html>")


Thanks,

Al


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
adding email Vista mail
Adding animations to email Live Mail
adding image signature Vista mail
WDS - Having issues adding drivers to image Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46