Jump to content

Write specific reg keys


Recommended Posts

Hi guys
I could use some help!

I am trying to define the default Outlook Email signature for a given user, with the help of Autoit.

This will do the job (but only with things manually defined by me)

RegWrite ("HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Profiles\Outlook\9375CFF0413111d3B88A00104B2A6676\00000003", "New Signature", "REG_BINARY", "74 00 65 00 73 00 74 00 00 00")

What this does, is to create or modify the current binary value called "New Signature" with the binary value "74 00 65 00 73 00 74 00 00 00" which in string language is "test" (with additional zeros)

So, it is now defined that the signature called "test" will be the default signature when clicking "New mail" in Outlook 2013.

Regarding the part with \Profiles\Outlook\...
Outlook is the name of my Outlook profile. It's also the default Outlook profilename. But sometimes users have a different profile name. So instead it could be a path like this:
HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Outlook\Profiles\AdifferentProfileName\.....

1. So first I need to define the name of a users default Outlook profile. This can be done in Powershell, but I don't know if it's possible in Autoit?
http://newdelhipowershellusergroup.blogspot.dk/2013/08/powershell-and-outlook-find-your.html

 

2. Next challenge is to make sure that the "New Signature" value will be created/modified for the correct Outlook Account. The folder "00000003" in the registry is the one containing outlook settings for my corporate email account. Inside this folder (where the "New Signature" value also is stored) there is an "Account Name" binary value. This one contains the name of the email account.
Alongside with the "00000003" folder there can be a "00000004" and "00000005" folder etc., containing email settings for let's say a hotmail and a gmail account, also added to Outlook.
So the script must determine which one of the "0000000X" folder that contains the "Account Name" binary value with my corporate email in it, and then only write the "New Signature" value in this one.
I have already determined in the top of my script which email address is my corporate email address, and it's defined in the script now as $emailaddress.
So if the email address is email@domain.com, the value of "Account Name" will be 65 00 6d 00 61 00 69 00 6c 00 40 00 64 00 6f 00 6d 00 61 00 69 00 6e 00 2e 00 63 00 6f 00 6d 00 00 00
There has to be 00 between every XX and additional 00 00 in the end. Somewhere a conversion from sring to hex has to be done. (adding the additional zeros)

 

3. Now the Default Outlook profile and the corporate email account has been determined. Last thing is the value of "New Signature" This has to be the actual name of the signature file.
So if I define somewhere in the script that my signature file is called test, the value of "New Signature" must be "74 00 65 00 73 00 74 00 00 00", since we also here need the additional zeros. So a conversion is needed here too.
Maybe something like this can help, which I found in another thread:
 

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

 

 

Yes this is quite complicated... I hope that there is someone who doesn't get scared about my request for help :D

Link to comment
Share on other sites

  • Moderators

Hi, david1337. Have you looked at the OutlookEX UDF? You should be able to create the new signature, and then use _OL_MailSignatureSet to set it for new and/or reply messages.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...