jhafmwes Posted July 22, 2015 Posted July 22, 2015 HelloI have obtained a script from another post that allows automated creation of Microsoft Outlook signatures. I will post the code below shortly. When the script runs it will output everything as Times New Roman, size 12. I would like the script to output as Arial, size 12.Would someone please be so kind to help me. I've tried researching and adding code which I thought was correct - though failing miserably.Thanks for all your help.
jhafmwes Posted July 22, 2015 Author Posted July 22, 2015 expandcollapse popup#include <GUIConstants.au3> #include <Misc.au3> #include <File.au3> #include <Process.au3> #include <Constants.au3> #include <string.au3> Dim $UserObj ; - OLD PATH STOPPED WORKING WITH WIN 7 - DIM $sigpath = ( @AppDataDir &'\microsoft\signatures' ) DIM $sigpath = ( 'C:\users\' & @UserName & '\AppData\Roaming\Microsoft\Signatures\' ) Dim $msg Dim $msg1 Dim $domain = @LogonDomain ;pulls domain that user is logged into Dim $username = @UserName ;pulls username that is logged in Const $ADS_NAME_INITTYPE_GC = 3 Const $ADS_NAME_TYPE_NT4 = 3 Const $ADS_NAME_TYPE_1779 = 1 $oMyError = ObjEvent("AutoIt.Error", "ComError") $objRootDSE = ObjGet("LDAP://RootDSE") ; DNS domain name. $objTrans = ObjCreate("NameTranslate") $objTrans.Init ($ADS_NAME_INITTYPE_GC, "") $objTrans.Set ($ADS_NAME_TYPE_1779, @LogonDomain) $objTrans.Set ($ADS_NAME_TYPE_NT4, @LogonDomain & "\" & @UserName) $strUserDN = $objTrans.Get ($ADS_NAME_TYPE_1779) $UserObj = ObjGet("LDAP://" & $strUserDN) DIM $fullname = $UserObj.FullName DIM $title = $UserObj.Title DIM $department = $UserObj.Department DIM $streetaddress = $UserObj.get("streetAddress") DIM $city = $UserObj.get("l") DIM $state = $UserObj.get("st") DIM $zipcode = $UserObj.PostalCodes DIM $country = $UserObj.get("c") DIM $emailaddress = $UserObj.EmailAddress DIM $extensionAttribute1 = $UserObj.extensionAttribute1 DIM $officenumber = $UserObj.TelephoneNumber DIM $mainnumber = $UserObj.Pager DIM $mobilenumber = $UserObj.TelephoneMobile DIM $faxnumber = $UserObj.FaxNumber DIM $homeMDB = $UserObj.get("homeMDB") Dim $homeMDBtext = StringSplit($homeMDB, ",") Dim $mailboxname = StringTrimLeft($homeMDBtext[4], 3) Dim $salutation = ("Best Regards,") Dim $Disclaimer = ("Disclaimer here") Dim $Defaultsigname = ("test") Dim $sightm = (@LogonDomain & ".htm") Dim $sigtxt = (@LogonDomain & ".txt") Dim $sigrtf = (@LogonDomain & ".rtf") call ("regsig") call ("textsig") call ("rtfsig") FileDelete($sigpath & "\tmp.htm") FileDelete($sigpath & "\tmp.rtf") FileDelete($sigpath & "\tmp.txt") Func regsig () FileInstall("sig.htm", $sigpath & "\tmp.htm",1) $filename1 = $sigpath & "\tmp.htm" _ReplaceStringInFile($filename1,"namenamename",$fullname) _ReplaceStringInFile($filename1,"emailemailemail","<a href='mailto:"& $emailaddress &"'>" & $emailaddress & "</a>") _ReplaceStringInFile($filename1,"titletitletitle",$title) _ReplaceStringInFile($filename1,"diddiddid",$officenumber) _ReplaceStringInFile($filename1,"faxfaxfax",$faxnumber) _ReplaceStringInFile($filename1,"extensionAttribute1extensionAttribute1extensionAttribute1",$extensionAttribute1) If $officenumber <>"" Then _ReplaceStringInFile($filename1,"offnumoffnumoffnum", "Direct: " & $officenumber) Else _ReplaceStringInFile($filename1,"offnumoffnumoffnum","") EndIf If $mobilenumber <>"" Then _ReplaceStringInFile($filename1,"mobilemobilemobile", "Mobile: " & $mobilenumber) Else _ReplaceStringInFile($filename1,"mobilemobilemobile","") EndIf FileCopy($filename1,$sigpath & "\" & $sightm,1) EndFunc Func textsig () FileInstall("sig.txt", $sigpath & "\tmp.txt",1) $filename1 = $sigpath & "\tmp.txt" _ReplaceStringInFile($filename1,"namenamename",$fullname) _ReplaceStringInFile($filename1,"emailemailemail",$emailaddress) _ReplaceStringInFile($filename1,"titletitletitle",$title) _ReplaceStringInFile($filename1,"diddiddid",$officenumber) _ReplaceStringInFile($filename1,"faxfaxfax",$faxnumber) _ReplaceStringInFile($filename1,"extensionAttribute1extensionAttribute1extensionAttribute1",$extensionAttribute1) If $officenumber <>"" Then _ReplaceStringInFile($filename1,"offnumoffnumoffnum", "Direct: " & $officenumber) Else _ReplaceStringInFile($filename1,"offnumoffnumoffnum","") EndIf If $mobilenumber <>"" Then _ReplaceStringInFile($filename1,"mobilemobilemobile", "Mobile: " & $mobilenumber) Else _ReplaceStringInFile($filename1,"mobilemobilemobile","") EndIf FileCopy($filename1,$sigpath & "\" & $sigtxt,1) EndFunc Func rtfsig () FileInstall("sig.rtf", $sigpath & "\tmp.rtf",1) $filename1 = $sigpath & "\tmp.rtf" _ReplaceStringInFile($filename1,"namenamename",$fullname) _ReplaceStringInFile($filename1,"emailemailemail",$emailaddress) _ReplaceStringInFile($filename1,"titletitletitle",$title) _ReplaceStringInFile($filename1,"diddiddid",$officenumber) _ReplaceStringInFile($filename1,"faxfaxfax",$faxnumber) _ReplaceStringInFile($filename1,"extensionAttribute1extensionAttribute1extensionAttribute1",$extensionAttribute1) If $officenumber <>"" Then _ReplaceStringInFile($filename1,"offnumoffnumoffnum", "Direct: " & $officenumber) Else _ReplaceStringInFile($filename1,"offnumoffnumoffnum","") EndIf If $mobilenumber <>"" Then _ReplaceStringInFile($filename1,"mobilemobilemobile", "Mobile: " & $mobilenumber) Else _ReplaceStringInFile($filename1,"mobilemobilemobile","") EndIf FileCopy($filename1,$sigpath & "\" & $sigrtf,1) EndFunc Func ComError() If IsObj($oMyError) Then $HexNumber = Hex($oMyError.number, 8) SetError($HexNumber) Else SetError(1) EndIf Return 0 EndFunc
PACaleala Posted July 25, 2015 Posted July 25, 2015 The script does its job.You have a problem with the defaults set for the signature files(Outlook).Look and learn here: http://www.mail-signatures.com/articles/how-to-create-or-modify-an-email-signature-in-outlook-2010-and-2013/
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now