joshiieeii Posted July 19, 2006 Share Posted July 19, 2006 (edited) Globalized Outlook and OWA Signature Project1st Real Project Posted BTW *edit: had to reattach attachment. Working on explaining how to edit the setsignature.xmlPurpose: To standardize a signature for all users using data from Active Directory. This script also includes adding signatures to Outlook Web Access (OWA). Settings can also be changed for both Outlook and OWA, this can include default message type (HTML, Rich Text, Text), default signature used, OWA timezone settings, ect... This script is meant to be ran within the login script to setup each user's signature.Versions:0.5 Initial Release 7-19-2006: Includes ability to change Outlook and OWA signatures. Ability to change settings in both Outlook and OWA.Explaination of files included in the zip file:EmailSig.au3: AutoIT scriptExCmd.exe : is from HERE. I have contacted the author and he has stated it is freeware. Feel free to scan it, prod it, whatever, I trust the source and have not seen any unwanted results from using it. It is simply a WEBDAV command line utility.getproperty.xml : is from the above site as well, it is used to replace variables before sending the command to the exchange server. Typically used to get the value of a property.setproperty.xml : is from the above site as well, it is used to replace variables before sending the command to the exchange server. Typically used to set the value of a property.setsignature.xml : is from the above site as well, it is used to replace variables before sending the command to the exchange server. Typically used to set the value of the signaturehtml field.Here is the code for anyone interested, I am still refining it, and welcome any suggestions on how to improve any portion of the code.expandcollapse popup#include <GUIConstants.au3> #include <Misc.au3> #include <File.au3> #include <Process.au3> #include <Constants.au3> #include <string.au3> Dim $UserObj DIM $sigpath = ( @AppDataDir &'\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 $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 $officenumber = $UserObj.TelephoneNumber 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 = ("test.html") Dim $siggif = ("testgif.html") Dim $sigtxt = ("test.txt") If FileExists ( $sigpath &'\'& $sightm) Then ;checks to see if the htm version of the signature is there returns '1'=exist '0'=does not exist Exit EndIf If FileExists ( $sigpath &'\'& $siggif) Then ;checks to see if the htm version with a gif image embedded in the signature is there returns '1'=exist '0'=does not exist Exit EndIf If FileExists ( $sigpath &'\'& $sigtxt) Then ;checks to see if the txt version of the signature is there returns '1'=exist '0'=does not exist Exit EndIf call ("regsig") call ("gifsig") call ("textsig") call ("SigRegisty") call ("OWAsig") call ("OWATimeZone") Func OWATimeZone (); Sets timezone to equal what is on the users PC Dim $timezone = RegRead ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation", "StandardName") Run(@ComSpec & " /c " & 'ExCmd proppatch http://'& $mailboxname &'.'& $domain &'/exchange/'& $username &' /c:setproperty.xml ns="http://schemas.microsoft.com/exchange/" name="timezone" value="'& $timezone &'"', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) EndFunc Func OWAsig () FileInstall (@ScriptDir &"\ExCmd.exe", @ScriptDir &"\ExCmd.exe") FileInstall (@ScriptDir &"\setsignature.xml", @ScriptDir &"\setsignature.xml") FileInstall (@ScriptDir &"\setproperty.xml", @ScriptDir &"\setproperty.xml") FileInstall (@ScriptDir &"\getproperty.xml", @ScriptDir &"\getproperty.xml") $filename = (@ScriptDir &"\setsignature.xml") ;Replaces Salutation $find = "<salutation>" $replace = ""& $salutation $retval = _ReplaceStringInFile($filename,$find,$replace) ;Replaces Fullname $find = "<fullname>" $replace = ""& $fullname $retval = _ReplaceStringInFile($filename,$find,$replace) ;Replaces the Department $find = "<department>" $replace = ""& $department $retval = _ReplaceStringInFile($filename,$find,$replace) ;Replaces the Office Number $find = "<officenumber>" $replace = ""& $officenumber $retval = _ReplaceStringInFile($filename,$find,$replace) ;Replaces the Mobile Number $find = "<mobilenumber>" $replace = ""& $mobilenumber $retval = _ReplaceStringInFile($filename,$find,$replace) ;Replaces the email address $find = "<emailaddress>" $replace = ""& $emailaddress $retval = _ReplaceStringInFile($filename,$find,$replace) ;Replaces the Street Address $find = "<streetaddress>" $replace = ""& $streetaddress $retval = _ReplaceStringInFile($filename,$find,$replace) ;Replaces the City $find = "<city>" $replace = ""& $city $retval = _ReplaceStringInFile($filename,$find,$replace) ;Replaces the state $find = "<state>" $replace = ""& $state $retval = _ReplaceStringInFile($filename,$find,$replace) ;Replaces the zipcode $find = "<zipcode>" $replace = ""& $zipcode $retval = _ReplaceStringInFile($filename,$find,$replace) ;Replaces the country $find = "<country>" $replace = ""& $country $retval = _ReplaceStringInFile($filename,$find,$replace) ;Replaces Disclaimer $find = "<disclaimer>" $replace = ""& $Disclaimer $retval = _ReplaceStringInFile($filename,$find,$replace) $foo = Run (@ComSpec & " /c " & 'ExCmd proppatch http://'& $mailboxname &'.'& $domain &'/exchange/'& $username &' /c:setsignature.xml ns="http://schemas.microsoft.com/exchange/" name="signaturehtml"', "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ;Testing purposes only ;Dim $foo1 = Run(@ComSpec & " /c " & 'exCmd propfind http://'& $mailboxname &'.'& $domain &'/exchange/'& $username &' /c:getproperty.xml ns="http://schemas.microsoft.com/exchange/" name="signaturehtml"', "", @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD) ;~ While 1 ;~ $line = StdoutRead($foo) ;~ If @error = -1 Then ExitLoop ;~ FileWrite ("C:\test.txt", $line &"") ;~ MsgBox(64, "STDOUT read:", $line) ;~ ;~ Wend ;~ While 1 ;~ $line = StdoutRead($foo1) ;~ If @error = -1 Then ExitLoop ;~ FileWrite ("C:\test.txt", $line &"") ;~ MsgBox(64, "STDOUT read:", $line) ;~ ;~ Wend EndFunc Func regsig () $filename1 = $sigpath & "\test.htm" $msg1 &= "<HTML><HEAD><TITLE>test Signature</TITLE>"& @CRLF $msg1 &= "<BODY>"& @CRLF $msg1 &= "<DIV align=left><FONT face=Arial size=2>"& $salutation &"</FONT></DIV>"& @CRLF $msg1 &= "<DIV align=left> </DIV>"& @CRLF $msg1 &= "<DIV align=left><FONT face=Arial size=2></FONT> </DIV>"& @CRLF $msg1 &= "<DIV align=left><FONT size=2><FONT face=Arial><STRONG><FONT" & @CRLF $msg1 &= "color=#808080>"& $fullname &"</FONT></STRONG> <STRONG><FONT " & @CRLF $msg1 &= "color=#808080>"& $department &"</FONT></STRONG></FONT></FONT></DIV>" & @CRLF $msg1 &= "<EM>technologies</EM></FONT></FONT></DIV>"& @CRLF $msg1 &= "<DIV align=left><FONT face=Arial size=2><STRONG>T:</STRONG> "& $officenumber &" <STRONG>M:</STRONG></FONT> "& $mobilenumber &" </DIV>"& @CRLF $msg1 &= "<DIV align=left><FONT face=Arial size=2><a href='mailto:"& $emailaddress &"'> "& $emailaddress &"</a> "& $streetaddress &" "& $city &", "& @CRLF $msg1 &= ""& $state &" "& $zipcode &" "& $country &"</FONT></DIV><FONT face='Arial' size=3></FONT><I><FONT color=#808080 size=1>"& $Disclaimer &"</FONT></DIV></I></BODY></HTML>" FileWrite($filename1, $msg1 );Writes the text to the html file EndFunc Func gifsig () $filename = $sigpath & "\testgif.htm" FileInstall(@ScriptDir &"\smalllogo2.gif", $sigpath & '\smalllogo2.gif') $msg &= "<HTML><HEAD><TITLE>test Signature with GIF</TITLE>"& @CRLF $msg &= "<BODY>"& @CRLF $msg &= "<DIV align=left><FONT face=Arial size=2>"& $salutation &"</FONT></DIV>"& @CRLF $msg &= "<DIV align=left> </DIV>"& @CRLF $msg &= "<DIV align=left><FONT face=Arial size=2></FONT> </DIV>"& @CRLF $msg &= "<DIV align=left><FONT size=2><FONT face=Arial><STRONG><FONT" & @CRLF $msg &= "color=#808080>"& $fullname &"</FONT></STRONG> <STRONG><FONT " & @CRLF $msg &= "color=#808080>"& $department &"</FONT></STRONG></FONT></FONT></DIV>" & @CRLF $msg &= "<DIV align=left><FONT size=2><FONT face=Arial> <STRONG><FONT color=#808080><IMG alt='' hspace=0 src='"& $sigpath & "\smalllogo2.gif' align=baseline border=0></FONT></STRONG></FONT></FONT> $msg &= "<DIV align=left><FONT face=Arial size=2><STRONG>T:</STRONG> "& $officenumber &" "& @CRLF $msg &= " <a href='mailto:"& $emailaddress &"'> "& $emailaddress &"</a> "& $streetaddress &" "& $city &", "& @CRLF $msg &= ""& $state &" "& $zipcode &" "& $country &"</FONT></DIV>"& @CRLF $msg &= "<DIV align=left><I><FONT face=Arial color=#808080 size=1>"& $Disclaimer &"</FONT></DIV></I></BODY></HTML>" FileWrite($filename, $msg );Writes the text to the html file EndFunc Func textsig () ;Text file creation $filename = $sigpath & "\test.txt" $msg = ""& $salutation & @CRLF $msg &= @CRLF $msg &= @CRLF $msg &= ""& $fullname &" "& $department &"" & @CRLF $msg &= "T: "& $officenumber &" M: "& $mobilenumber &" "& @CRLF $msg &= ""& $emailaddress &" "& $streetaddress &" "& $city &", "& $state &" "& $zipcode &" "& $country &"" & @CRLF $msg &= ""& $Disclaimer FileWrite($filename, $msg );Writes the text to the file EndFunc Func SigRegisty ();Changes registry settings for Outlook $var = RegRead ("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Options\Mail\", "EditorPreference") if $var = 131072 Then Else RegWrite ("HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Options\Mail\", "EditorPreference", "REG_DWORD", "131072");Changes the default format for outgoing messages to HTML EndIf ;Working on adding a string to HEX conversion for the name of the default signature, ;Writes NEW Signature as the default signature (Requires Restart of Outlook to take affect). Set your signature and drill down in the resgistry to find the HEX value for the signature name RegWrite ("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\%profilename%\9375CFF0413111d3B88A00104B2A6676\00000001", "New Signature", "REG_BINARY", "%HEX Signature name with 00 between each letter and trailing 0000000%") EndFunc ;COM Error function Func ComError() If IsObj($oMyError) Then $HexNumber = Hex($oMyError.number, 8) SetError($HexNumber) Else SetError(1) EndIf Return 0 EndFunc ;==>ComErrorEmailSig.zip Edited July 26, 2006 by joshiieeii Projects:Vista Gui ImageX Deployment Tool - CompletedActive Directory Helper - CompletedGlobalized Outlook and OWA Signature Project - Completed Link to comment Share on other sites More sharing options...
joshiieeii Posted July 19, 2006 Author Share Posted July 19, 2006 **Updated attached file to include sample setsignature.xml Projects:Vista Gui ImageX Deployment Tool - CompletedActive Directory Helper - CompletedGlobalized Outlook and OWA Signature Project - Completed Link to comment Share on other sites More sharing options...
ptrex Posted July 25, 2006 Share Posted July 25, 2006 @joshiieeii Great stuff, something I can use definitely !! Not tested yet but will soon. PS: Do you have a script that globally updates the Outlook Global Contacts settings. I mean setting the parameter to "Show this folder as an E-mail folder as an Email Address Book". because at the moment I am doing this manually on each PC. Which is stupid of course. Any help is welcome. Keep up the good work !! Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
joshiieeii Posted July 25, 2006 Author Share Posted July 25, 2006 (edited) Thanks, I have not heard about this issue you are having, but I can look into it. Let me know if you have any questions.*Edit: I am in the process of making an editor to help create and insert the replacement holders for the signatures HERE Edited July 25, 2006 by joshiieeii Projects:Vista Gui ImageX Deployment Tool - CompletedActive Directory Helper - CompletedGlobalized Outlook and OWA Signature Project - Completed Link to comment Share on other sites More sharing options...
lod3n Posted October 18, 2006 Share Posted October 18, 2006 You can use this to create the hex string containing the name:func unihex($value) $newvalue = "" for $i=1 to stringlen($value) $curchar = stringmid($value,$i,1) $ascii = asc($curchar) $z=Hex($ascii,2) $newvalue=$newvalue & $z & "00" next return $newvalue & "0000" endfunc [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
lod3n Posted October 18, 2006 Share Posted October 18, 2006 Oh, and you can use this to apply the changes immediately without restarting Outlook: if processExists("OUTLOOK.EXE") Then $objWord = ObjCreate("Word.Application") ; this is insane, yes - but it works $objEmailOptions = $objWord.EmailOptions $objSignatureObject = $objEmailOptions.EmailSignature $objSignatureObject.NewMessageSignature = $signame $objSignatureObject.ReplyMessageSignature = $signame $objWord.quit() EndIf [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
Fabiam Posted September 17, 2007 Share Posted September 17, 2007 Hallo, i can not compile the script with the current Autoit version. C:\Users\xxx\Desktop\EmailSig\EmailSig\EmailSig.au3(185,125) : ERROR: syntax error (illegal character) $msg &= "<DIV align=left><FONT size=2><FONT face=Arial> <STRONG><FONT color=#808080><IMG alt='' hspace=0 src='"& $sigpath & " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\xxx\Desktop\EmailSig\EmailSig\EmailSig.au3(185,167) : ERROR: syntax error (illegal character) $msg &= "<DIV align=left><FONT size=2><FONT face=Arial> <STRONG><FONT color=#808080><IMG alt='' hspace=0 src='"& $sigpath & "\smalllogo2.gif' align=baseline border=0>< ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Users\xxx\Desktop\EmailSig\EmailSig\EmailSig.au3 - 2 error(s), 0 warning(s) Link to comment Share on other sites More sharing options...
lod3n Posted September 17, 2007 Share Posted September 17, 2007 Remove the line breaks from each of those two lines. The forum added them to the original poster's message because they were so long, but you need to manually remove them. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
Willian Posted October 9, 2007 Share Posted October 9, 2007 I would like to implement the Standard Signature but I don't know how. I already read this subject and I didn't understand. Can you give me a "step-by-step" procedure? I have Windows 2003 Server, Exchange 2003 Server, Windows XP Pro and Office Outlook 2003/2007. Thanks. Link to comment Share on other sites More sharing options...
dmollico Posted November 1, 2007 Share Posted November 1, 2007 (edited) A few notes for anyone else going to use this only because I spent a bunch of time making it work with my network. First off - DAMN! What a program and absolutely awesome! Now - on to the nit picking: A good portion of this stuff might be mentioned somewhere else - but whatever 1. the downloaded script on line 184 needs an ending quote " 2. You will want to add a bunch of <BR> to different places in the signature so it will properly line feed. 3. I added some brief conditions to check to see if mobile phone and fax existed, then if they did, included them in the making of the signature expandcollapse popup; find out if the cell and fax variables contain anything If $mobilenumber Then $mobiletrue = "<STRONG>Cell:</STRONG> "& $mobilenumber &"<BR>" If $faxnumber Then $faxtrue = "<STRONG>Fax:</STRONG> "& $faxnumber &"<BR>" ; setup the signature $msg1 &= "<HTML><HEAD><TITLE>MWBank Signature</TITLE>"& @CRLF $msg1 &= "<BODY>"& @CRLF ; $msg1 &= "<DIV align=left><FONT face=Arial size=2>"& $salutation &"</FONT></DIV>"& @CRLF $msg1 &= "<DIV align=left> </DIV>"& @CRLF $msg1 &= "<DIV align=left><FONT face=Arial size=2></FONT> </DIV>"& @CRLF $msg1 &= "<DIV align=left><FONT size=2><FONT face=Arial><STRONG><FONT" & @CRLF $msg1 &= "color=#808080>"& $fullname &"<BR></FONT></STRONG> <STRONG><FONT " & @CRLF $msg1 &= "color=#808080>"& $title &"</FONT></STRONG></FONT></FONT></DIV>" & @CRLF $msg1 &= "<EM>" & $company & "</EM></FONT></FONT></DIV>"& @CRLF $msg1 &= "<DIV align=left><FONT face=Arial size=2><STRONG>Office:</STRONG> "& $officenumber &"<BR>" & @CRLF If $mobilenumber Then $msg1 &= $mobiletrue If $faxnumber Then $msg1 &= $faxtrue $msg1 &= " </DIV>"& @CRLF $msg1 &= "<DIV align=left><FONT face=Arial size=2><a href='mailto:"& $emailaddress &"'> "& $emailaddress &"</a>" & @CRLF $msg1 &= "<BR><a href='http://www.mwankonline.com'>http://www.MWBankonline.com</a>" & @CRLF $msg1 &= "<BR><BR>" & $company & " - " & $office & "<BR>" & $streetaddress &"<BR>"& $city &", "& @CRLF $msg1 &= ""& $state &" "& $zipcode &" "& $country &"</FONT></DIV><FONT face='Arial' size=3></FONT><I><FONT color=#808080 size=1>"& $Disclaimer &"</FONT></DIV></I></BODY></HTML>"oÝ÷ ÛbÖ¥íábâ'²Ö¥'+C¶¦¦«¨·Ov¦uì^ªê-IÊâ¦Ðâ©©ªê-ÓÝÄ){ªº¢iÛص¡ûazö«¦åzȧ¶¦Êj}ýµÊ&¦)^Â+a¶¶¬±ç¦²Ú0¢¹'Ç¥ÈX¥x쵩eªê-¦uì^ªê-ªê-¦uì^ªê-èò¢ìÛhºÇꮢÚ~'ªê-~'¥v߶zw«j[Zn)À«{*.È3Mú¡÷âqoÝ÷ ÛÍg£,j'h¢Ø^~)ÚÊ&¦)^v¨¹§]¶rWêbú+«b¢|!Ég¥·jëü¨ºëاʫµë-²Û~+pY]zW{*.®wuç^ÆÚÚ~)^²¸ Ú.¶íçbç-¢¼¦jH§Ø^±Êâ¦Û¬zW¬±Ú'ßÛZ²B0jË©±ë}"·j}ý¶Æ²'Ç¥¡ÝçßÛ,r¸©¶Éâ¦+b²Ú&jG¢µú+qëazÈ «n觶k¡Û¶*'iv&z*.v÷öÜÛhºÈë-«Þ¶¬±Êâ¦Ú®¢Úk¡Ç¬±Éh±ê®¢Ú.¶Z(ì^ªê-®(!µúèØ^²Ö«µ©ÝÊ°¢}ý¶¯y©â²Ë×KazÇ+ZºÚç$±ú+¶W¬×+y«^±©Ýv¬m®éâ~+_wl¶¦"اjÉ+j^®Êr¥uÈZ«[z¯«Âü¨»§¶+m¢·«ºz'²¢w·öÉr§zÞ½êò¢w·öÉr§yÛ¶(é²È¯yÈZ§{(§Êv¦yëjëh×6$sigcheckenabled = 0 ;change to a 1 to enable existing signature check If $sigcheckenabled = 1 Then If FileExists ( $sigpath &'\'& $sightm) Then ;checks to see if the htm version of the signature is there returns '1'=exist '0'=does not exist Exit EndIf If FileExists ( $sigpath &'\'& $siggif) Then ;checks to see if the htm version with a gif image embedded in the signature is there returns '1'=exist '0'=does not exist Exit EndIf If FileExists ( $sigpath &'\'& $sigtxt) Then ;checks to see if the txt version of the signature is there returns '1'=exist '0'=does not exist Exit EndIf Else FileDelete ( $sigpath &'\'& $sightm) FileDelete ( $sigpath &'\'& $siggif) FileDelete ( $sigpath &'\'& $sigtxt) EndIf 11. once again - I couldn't have come up with this on my own - this is an awesome script and I will definately put it to good use - I just wanted everyone to have the above information! Edited November 1, 2007 by dmollico Link to comment Share on other sites More sharing options...
saturno Posted October 31, 2008 Share Posted October 31, 2008 Hi Everyone, Sorry for waking up this thread exactly one year later, but if someone could give me any advice, I really apreciate it. Being in a middle of a Exchange 2003 reimplementation project, I found this thread when looking for a way to standardize owa signatures. Just tested the availlable script, and my first impression is - Awesome. This is awesome. I'm a system administrator wich don't have any programing skills. I can read and understand the code, make some little adjustments, nothing more so please don't laugh at my question. Is it expectable that this script could create and put in place an OWA signature? I tested this in my work PC with Outlook 2003 and it worked flawlessly! Bu it only created the Outlook signature. Is there any way to make it work for OWA signatures? I have many user wich only access their e-mail's through OWA, many of them via Terminal Services. Is this possible? Thanks for any help. Link to comment Share on other sites More sharing options...
Kage Posted June 9, 2011 Share Posted June 9, 2011 Big bad necro post im doing here. but i'd really like to get this working. when trying to compile this script (after fixing the missing quote) i keep getting "Invalid Fileinstall() Function:" anyone that cares/can help me ? Link to comment Share on other sites More sharing options...
water Posted June 9, 2011 Share Posted June 9, 2011 The FileInstall stuff is only necessary if you want to create a signature for OWA (Outlook Web Access). If you just want a signature for Outlook you can comment it out. BTW: I just found this thread and I think it would be a good idea to include the Outlook signature stuff into my OutlooKEX UDF. What do you think? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Kage Posted June 9, 2011 Share Posted June 9, 2011 The FileInstall stuff is only necessary if you want to create a signature for OWA (Outlook Web Access). If you just want a signature for Outlook you can comment it out.BTW: I just found this thread and I think it would be a good idea to include the Outlook signature stuff into my OutlooKEX UDF. What do you think?i think its a good idea, this signature idea for outlook is really awesome.great to use in GPO's for big company'sill try commenting out the fileinstall stuff Link to comment Share on other sites More sharing options...
supersonic Posted June 10, 2011 Share Posted June 10, 2011 (edited) Hi water, as I started with AutoIt some years ago one of my scripting projects was - and still is - an Outlook Signature Generator. So, I re-invented the wheel once more... This script is based on your AD.au3 UDF and the _XMLDomWrapper.au3 UDF from eltorro. In the meantime I found [ http://www.zerbit.de/projekte/outlooksignature.aspx ], but this does not fit my needs. Here are my thoughts on that: - This is rather another UDF project than just a new function to your OutlookEX.au3 UDF. There are so many things to pay attention to. Maybe this would exceed the focus of your UDF. Maybe it should become a "cross-UDF-project" (because of the need of AD and XML functions)? - As many forum users stated before the currenty version of _XMLDomWrapper.au3 is not in a really good state; it is not well maintained at the moment... So, do we have to write our own? - The signature file should be created line by line. Template files are - I know - handy, but you have too many limitations with them. Here are two simplified examples: 1. If you have the following line "@JOB_GERMAN@ / @JOB_ENGLISH@" and the placeholder "@JOB_ENGLISH@" is an empty string you would like to remove the "/" after "@JOB_GERMAN@". 2. If a placeholder is or more placeholders are empty then you would like to skip this line. There could be many more examples... Template files are too solid/static to fit everyone needs. This is the reason why I store my "templates" in a XML file so I can process line by line and can handle issues like above. - Currently I have to modify this "templates" with an XML editor, like [ http://www.altova.com/ ]. Doing this manually is no real problem with a good XML editor, but to be handy to others too, you need a GUI to edit your templates more easily... - In our company the signature files are generated within the NETLOGON process (or GPO based if you like). So, there will be a need of linking them into Outook while OUTLOOK.EXE is not running... (No real big deal, but you have to keep that in mind...) - Furthermore it would be nice if you could store GIF or JPG files in the XML template file. Currently there is no need for this in our company; it would be easy to embed them as "CDATA" type. - At last you should keep in mind that there are three (3) files (= types) for each signature; there is a HTML, a RTF and a TXT file. During signature generation process, all of them should be created... I would really look forward if this becomes a new project. Maybe I could help a bit... Greets, -supersonic. Edited June 10, 2011 by supersonic Link to comment Share on other sites More sharing options...
water Posted June 10, 2011 Share Posted June 10, 2011 Hi supersonic,... and I think it would be a good idea to include the Outlook signature stuff into my OutlooKEX UDF ...I didn't mean to put all this signature creation stuff into the UDF. I thought about letting the user create a signature and then tell Outlook that there is a new signature and when to use it. What I have so far is a function to list all available signatures and tell you if they are used as default signature for new or reply messages: expandcollapse popup#include <OutlookEx.au3> #include <array.au3> $oOutlook = _OL_Open() Global $aResult = _OL_MailSignatureGet() _ArrayDisplay($aResult) ; #FUNCTION# ==================================================================================================================== ; Name ..........: _OL_MailSignatureGet ; Description ...: Gets a list of e-mail signatures used when you create/edit e-mail messages and replies. ; Syntax.........: _OL_MailSignatureGet() ; Parameters ....: None ; Return values .: Success - two-dimensional one based array with the following information: ; |0 - Name of the signature ; |1 - True if the signature is used when creating new messages ; |2 - True if the signature is used when replying to a message ; Failure - Returns "" and sets @error: ; |1 - Error accessing word object. For details check @extended ; Author ........: water ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _OL_MailSignatureGet() Local $oOL_Word = ObjCreate("Word.Application") If Not IsObj($oOL_Word) Or @error <> 0 Then Return SetError(1, @error, "") Local $oOL_EmailOptions = $oOL_Word.EmailOptions Local $oOL_SignatureObject = $oOL_EmailOptions.EmailSignature Local $oOL_SignatureEntries = $oOL_SignatureObject.EmailSignatureEntries Local $sOL_NewMessageSig = $oOL_SignatureObject.NewMessageSignature Local $sOL_ReplyMessageSig = $oOL_SignatureObject.ReplyMessageSignature Local $aOL_Signatures[$oOL_SignatureEntries.Count + 1][3] = [[$oOL_SignatureEntries.Count, 3]] Local $iOL_Index = 1 For $oOL_SignatureEntry In $oOL_SignatureEntries $aOL_Signatures[$iOL_Index][0] = $oOL_SignatureEntry.Name If $aOL_Signatures[$iOL_Index][0] = $sOL_NewMessageSig Then $aOL_Signatures[$iOL_Index][1] = True Else $aOL_Signatures[$iOL_Index][1] = False Endif If $aOL_Signatures[$iOL_Index][0] = $sOL_ReplyMessageSig Then $aOL_Signatures[$iOL_Index][2] = True Else $aOL_Signatures[$iOL_Index][2] = False EndIf $iOL_Index = $iOL_Index + 1 Next $oOL_Word.Quit $oOL_Word = 0 Return $aOL_Signatures EndFunc ;==>_OL_MailSignatureGet and another one to create a simple signature:expandcollapse popup#include <OutlookEx.au3> $oOutlook = _OL_Open() ; Create new Signature Local $oOL_Word = ObjCreate("Word.Application") Local $oOL_Doc = $oOL_Word.Documents.Add() Local $oOL_Selection = $oOL_Word.Selection $oOL_Selection.TypeText("Text of test Signature") $oOL_Selection = $oOL_Doc.Range() $iResult = _OL_MailSignatureCreate("Test-UDF", $oOL_Word, $oOL_Selection, False, False) ; #FUNCTION# ==================================================================================================================== ; Name ..........: _OL_MailSignatureCreate ; Description ...: Creates a new/modifies an existing e-mail signature. ; Syntax.........: _OL_MailSignatureCreate($sOL_Name, $oOL_Word, $oOL_Range[, $bOL_NewMessage = False[, $bOL_ReplyMessage = False]]) ; Parameters ....: $sOL_Name - Name of the signature to be created/modified. ; $oOL_Range - Range (as defined by the word range method) that contains the signature text + formatting ; $bOL_NewMessage - Optional: True sets the signature as the default signature to be added to new email messages (default = False) ; $bOL_ReplyMessage - Optional: True sets the signature as the default signature to be added when you reply to an email messages (default = False) ; Return values .: Success - 1 ; Failure - Returns 0 and sets @error: ; |1 - $oOL_Word is not an object ; |2 - $sOL_Name is empty ; |3 - $oOL_Range is not an object ; |4 - Error adding signature. For details check @extended ; Author ........: water ; Modified ......: ; Remarks .......: If the signature already exist $bOL_NewMessage and $bOL_ReplyMessage can be set but not unset. Use _OL_MailSignatureSet in this case. ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _OL_MailSignatureCreate($sOL_Name, $oOL_Word, $oOL_Range, $bOL_NewMessage, $bOL_ReplyMessage) If Not IsObj($oOL_Word) Then Return SetError(1, @error, "") If $sOL_Name = "" Then Return SetError(2, @error, "") If Not IsObj($oOL_Range) Then Return SetError(3, @error, "") Local $oOL_EmailOptions = $oOL_Word.EmailOptions Local $oOL_SignatureObject = $oOL_EmailOptions.EmailSignature Local $oOL_SignatureEntries = $oOL_SignatureObject.EmailSignatureEntries $oOL_SignatureEntries.Add($sOL_Name, $oOL_Range) If @error <> 0 Then Return SetError(4, @error, 0) If $bOL_NewMessage Then $oOL_SignatureObject.NewMessageSignature = $sOL_Name If $bOL_ReplyMessage Then $oOL_SignatureObject.ReplyMessageSignature = $sOL_Name Return 1 EndFunc Functions to delete / rename / (maybe edit) signatures will follow. How does this sound? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
supersonic Posted June 10, 2011 Share Posted June 10, 2011 Hi water, ohhh, I understand your point of view. But I still think, if it comes to editing, it should be a new UDF project... What about setting signatures for OWA? Greets, -supersonic. Link to comment Share on other sites More sharing options...
water Posted June 10, 2011 Share Posted June 10, 2011 (edited) But I still think, if it comes to editing, it should be a new UDF project...What about setting signatures for OWA?D'accord - signature editing should be in a new UDF. There seem to be multiple ways to create signatures:Manually create the signature files (.txt, .rtf and .htm) plus create the necessary registry keys so Outlook knows about them. That's something that can be done without starting Outlook. But you can't add a new signature while Outlook is running, it has to be restartedUse Word to create a signature and add it via COM to Outlook. Outlook has to be running and new signatures can be used immediately. That's what I'm gonna do with the _OL_MailSignatureCreate functionHow to set signatures for OWA is completely out of my scope because OWA is so different compared to Outlook. Edited June 10, 2011 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
JonF Posted May 18, 2012 Share Posted May 18, 2012 (edited) when trying to compile this script (after fixing the missing quote) i keep getting "Invalid Fileinstall() Function:" anyone that cares/can help me ? Taking a look at this project... sure looks interesting. I have a signature generator based on GenerateSignatureFromLDAP but it doesn't do the XML version. The "Invalid FileInstall" is caused by the "@ScriptDir &" in all the first arguments in the FIleInstall calls. Remove "@ScriptDir & " from all of the first arguments and put a dot in front of the first backslash: FileInstall (".\ExCmd.exe", @ScriptDir &"\ExCmd.exe") FileInstall (".\setsignature.xml", @ScriptDir &"\setsignature.xml") FileInstall (".\setproperty.xml", @ScriptDir &"\setproperty.xml") FileInstall (".\getproperty.xml", @ScriptDir &"\getproperty.xml") . . . FileInstall(".\smalllogo2.gif", $sigpath & '\smalllogo2.gif') Edited May 18, 2012 by JonF Link to comment Share on other sites More sharing options...
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