' ##############################################################################
' # Lupi Gabriel #
' # www.lupigabriel.it #
' # info@lupigabriel.it #
' ##############################################################################
' # Copyright (c) 2014 Lupi Gabriel All rights reserved. #
' ##############################################################################
' # VERSION : 1.0 #
' # FILE : OutlookSignature.vbs #
' # CLASS : Script #
' # LANGUAGE : VB Script #
' # OUPUT : "%AppData%\Microsoft\Signatures" #
' ##############################################################################
On Error Resume Next
' SETTINGS
OutlookSignatureVersion = "000" ' set to 000 to refresh signature on every logon
OutlookSignatureBinName = Array(79,0,117,0,116,0,108,0,111,0,111,0,107,0,83,0,105,0,103,0,110,0,97,0,116,0,117,0,114,0,101,0,0,0)
OutlookSignatureFirsNew = 1 ' automatic activation of the signature for new messages
OutlookSignatureFirsRep = 1 ' automatic activation of the signature for replies and forwards
OutlookSignatureRefrNew = 1 ' force re-activation of the signature for new messages on every logon
OutlookSignatureRefrRep = 1 ' force re-activation of the signature for replies and forwards messages on every logon
' START
OutlookSignatureRemPath = Replace(Wscript.ScriptFullName, Wscript.ScriptName, "")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
SignatureFlag = oShell.ExpandEnvironmentStrings("%APPDATA%") & "\Microsoft\Signatures\OutlookSignature_files\OutlookSignature." & OutlookSignatureVersion
SignatureFrst = oShell.ExpandEnvironmentStrings("%APPDATA%") & "\Microsoft\Signatures\OutlookSignature_files\OutlookSignature.first"
SignaturePath = oShell.ExpandEnvironmentStrings("%APPDATA%") & "\Microsoft\Signatures\"
UserDeskTempl = oShell.ExpandEnvironmentStrings("%USERPROFILE%") & "\Desktop\OutlookSignature\"
Set objRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
SetRegCounter = 0
' TEMPLATE
If objFSO.FileExists(OutlookSignatureRemPath & "OutlookSignature.txt") = False Or objFSO.FileExists(OutlookSignatureRemPath & "OutlookSignature.htm") = False Or objFSO.FolderExists(OutlookSignatureRemPath & "OutlookSignature_files") = False Then
TextMsgBox = "Create from Outlook the New Signature Template named ""OutlookSignature"" with the following Tags..." & vbCrLf & vbCrLf & _
"###FIRSTNAME###" & vbCrLf & _
"###INITIALS###" & vbCrLf & _
"###LASTNAME###" & vbCrLf & _
"###DISPLAYNAME###" & vbCrLf & _
"###DESCRIPTION###" & vbCrLf & _
"###OFFICENAME###" & vbCrLf & _
"###TELEPHONE###" & vbCrLf & _
"###OTHERTELEPHONE###" & vbCrLf & _
"###EMAIL###" & vbCrLf & _
"###WEBPAGE###" & vbCrLf & _
"###OTHERWEBPAGE###" & vbCrLf & _
"###STREETADDRESS###" & vbCrLf & _
"###POSTOFFICEBOX###" & vbCrLf & _
"###CITY###" & vbCrLf & _
"###STATE###" & vbCrLf & _
"###POSTALCODE###" & vbCrLf & _
"###COUNTRYCODE###" & vbCrLf & _
"###HOMEPHONE###" & vbCrLf & _
"###OTHERHOMEPHONE###" & vbCrLf & _
"###PAGER###" & vbCrLf & _
"###OTHERPAGER###" & vbCrLf & _
"###MOBILEPHONE###" & vbCrLf & _
"###OTHERMOBILEPHONE###" & vbCrLf & _
"###FAX###" & vbCrLf & _
"###OTHERFAX###" & vbCrLf & _
"###IPPHONE###" & vbCrLf & _
"###OTHERIPPHONE###" & vbCrLf & _
"###NOTES###" & vbCrLf & _
"###JOBTITLE###" & vbCrLf & _
"###DEPARTMENT###" & vbCrLf & _
"###COMPANY###" & vbCrLf & _
"###MANAGER###" & vbCrLf & _
vbCrLf & "Save Template from Outlook and click ""OK"" to create OutlookSignature Source Files..."
UserMsg = MsgBox(TextMsgBox, 0, "OutlookSignature")
If objFSO.FileExists(SignaturePath & "OutlookSignature.txt") = False Or objFSO.FileExists(SignaturePath & "OutlookSignature.htm") = False Or objFSO.FolderExists(SignaturePath & "OutlookSignature_files") = False Then
UserMsg = MsgBox("Warning! OutlookSignature Template is not present in Outlook..." & vbCrLf & vbCrLf & "You Must Create Template and Re-launch the Script...", 0, "OutlookSignature")
Wscript.Quit
End If
If objFSO.FolderExists(OutlookSignatureRemPath & "OutlookSignature_files\") = True Then objFSO.DeleteFolder OutlookSignatureRemPath & "OutlookSignature_files\" End If
If objFSO.FileExists(OutlookSignatureRemPath & "OutlookSignature.htm") = True Then objFSO.DeleteFile OutlookSignatureRemPath & "OutlookSignature.htm" End If
If objFSO.FileExists(OutlookSignatureRemPath & "OutlookSignature.txt") = True Then objFSO.DeleteFile OutlookSignatureRemPath & "OutlookSignature.txt" End If
objFSO.CreateFolder OutlookSignatureRemPath & "OutlookSignature_files\"
objFSO.CopyFile SignaturePath & "OutlookSignature.txt", OutlookSignatureRemPath
objFSO.CopyFile SignaturePath & "OutlookSignature.htm", OutlookSignatureRemPath
objFSO.CopyFile SignaturePath & "OutlookSignature_files\*", OutlookSignatureRemPath & "OutlookSignature_files\"
If objFSO.FileExists(OutlookSignatureRemPath & "OutlookSignature.txt") = False Or objFSO.FileExists(OutlookSignatureRemPath & "OutlookSignature.htm") = False Or objFSO.FolderExists(OutlookSignatureRemPath & "OutlookSignature_files") = False Then
UserMsg = MsgBox("Warning! OutlookSignature Template files are not copied in source path..." & vbCrLf & vbCrLf & "Please check write permission in source path and Re-launch the Script...", 0, "OutlookSignature")
Wscript.Quit
End If
UserMsg = MsgBox("OutlookSignature Template is now created and copied in source path..." & vbCrLf & vbCrLf & OutlookSignatureRemPath, 0, "OutlookSignature")
Wscript.Quit
End If
' DEPLOY
If objFSO.FileExists(SignatureFlag) = False Or OutlookSignatureVersion = "000" Then
If objFSO.FolderExists(SignaturePath & "OutlookSignature_files") = True Then objFSO.DeleteFolder SignaturePath & "OutlookSignature_files" End If
If objFSO.FileExists(SignaturePath & "OutlookSignature.htm") = True Then objFSO.DeleteFile SignaturePath & "OutlookSignature.htm" End If
If objFSO.FileExists(SignaturePath & "OutlookSignature.txt") = True Then objFSO.DeleteFile SignaturePath & "OutlookSignature.txt" End If
If objFSO.FileExists(SignaturePath & "OutlookSignature.rtf") = True Then objFSO.DeleteFile SignaturePath & "OutlookSignature.rtf" End If
If objFSO.FolderExists(SignaturePath) = False Then objFSO.CreateFolder SignaturePath End If
If objFSO.FolderExists(SignaturePath & "OutlookSignature_files") = False Then
objFSO.CreateFolder SignaturePath & "OutlookSignature_files"
objFSO.CopyFile OutlookSignatureRemPath & "OutlookSignature.txt", SignaturePath & "OutlookSignature.txt.template"
objFSO.CopyFile OutlookSignatureRemPath & "OutlookSignature.htm", SignaturePath & "OutlookSignature.htm.template"
objFSO.CopyFile OutlookSignatureRemPath & "OutlookSignature_files\*", SignaturePath & "OutlookSignature_files\"
End If
' AD USER INFO
Set objSysInfo = CreateObject("ADSystemInfo")
Set objUser = GetObject("LDAP://" & objSysInfo.UserName)
Set objUserMan = GetObject("LDAP://" & objUser.manager)
If objUser.givenName = "" Or IsNull(objUser.givenName) = True Then Sign_givenName = "" Else Sign_givenName = objUser.givenName End If
If objUser.initials = "" Or IsNull(objUser.initials) = True Then Sign_initials = "" Else Sign_initials = objUser.initials End If
If objUser.sn = "" Or IsNull(objUser.sn) = True Then Sign_sn = "" Else Sign_sn = objUser.sn End If
If objUser.displayName = "" Or IsNull(objUser.displayName) = True Then Sign_displayName = "" Else Sign_displayName = objUser.displayName End If
If objUser.description = "" Or IsNull(objUser.description) = True Then Sign_description = "" Else Sign_description = objUser.description End If
If objUser.physicalDeliveryOfficeName = "" Or IsNull(objUser.physicalDeliveryOfficeName) = True Then Sign_physicalDeliveryOfficeName = "" Else Sign_physicalDeliveryOfficeName = objUser.physicalDeliveryOfficeName End If
If objUser.telephoneNumber = "" Or IsNull(objUser.telephoneNumber) = True Then Sign_telephoneNumber = "" Else Sign_telephoneNumber = objUser.telephoneNumber End If
If objUser.otherTelephone = "" Or IsNull(objUser.otherTelephone) = True Then Sign_otherTelephone = "" Else Sign_otherTelephone = objUser.otherTelephone End If
If objUser.mail = "" Or IsNull(objUser.mail) = True Then Sign_mail = "" Else Sign_mail = objUser.mail End If
If objUser.wWWHomePage = "" Or IsNull(objUser.wWWHomePage) = True Then Sign_wWWHomePage = "" Else Sign_wWWHomePage = objUser.wWWHomePage End If
If objUser.url = "" Or IsNull(objUser.url) = True Then Sign_url = "" Else Sign_url = objUser.url End If
If objUser.streetAddress = "" Or IsNull(objUser.streetAddress) = True Then Sign_streetAddress = "" Else Sign_streetAddress = objUser.streetAddress End If
If objUser.postOfficeBox = "" Or IsNull(objUser.postOfficeBox) = True Then Sign_postOfficeBox = "" Else Sign_postOfficeBox = objUser.postOfficeBox End If
If objUser.l = "" Or IsNull(objUser.l) = True Then Sign_l = "" Else Sign_l = objUser.l End If
If objUser.st = "" Or IsNull(objUser.st) = True Then Sign_st = "" Else Sign_st = objUser.st End If
If objUser.postalCode = "" Or IsNull(objUser.postalCode) = True Then Sign_postalCode = "" Else Sign_postalCode = objUser.postalCode End If
If objUser.countryCode = "" Or IsNull(objUser.countryCode) = True Then Sign_countryCode = "" Else Sign_countryCode = objUser.countryCode End If
If objUser.homePhone = "" Or IsNull(objUser.homePhone) = True Then Sign_homePhone = "" Else Sign_homePhone = objUser.homePhone End If
If objUser.otherHomePhone = "" Or IsNull(objUser.otherHomePhone) = True Then Sign_otherHomePhone = "" Else Sign_otherHomePhone = objUser.otherHomePhone End If
If objUser.pager = "" Or IsNull(objUser.pager) = True Then Sign_pager = "" Else Sign_pager = objUser.pager End If
If objUser.otherPager = "" Or IsNull(objUser.otherPager) = True Then Sign_otherPager = "" Else Sign_otherPager = objUser.otherPager End If
If objUser.mobile = "" Or IsNull(objUser.mobile) = True Then Sign_mobile = "" Else Sign_mobile = objUser.mobile End If
If objUser.otherMobile = "" Or IsNull(objUser.otherMobile) = True Then Sign_otherMobile = "" Else Sign_otherMobile = objUser.otherMobile End If
If objUser.facsimileTelephoneNumber = "" Or IsNull(objUser.facsimileTelephoneNumber) = True Then Sign_facsimileTelephoneNumber = "" Else Sign_facsimileTelephoneNumber = objUser.facsimileTelephoneNumber End If
If objUser.otherFacsimileTelephoneNumber = "" Or IsNull(objUser.otherFacsimileTelephoneNumber) = True Then Sign_otherFacsimileTelephoneNumber = "" Else Sign_otherFacsimileTelephoneNumber = objUser.otherFacsimileTelephoneNumber End If
If objUser.ipPhone = "" Or IsNull(objUser.ipPhone) = True Then Sign_ipPhone = "" Else Sign_ipPhone = objUser.ipPhone End If
If objUser.otherIpPhone = "" Or IsNull(objUser.otherIpPhone) = True Then Sign_otherIpPhone = "" Else Sign_otherIpPhone = objUser.otherIpPhone End If
If objUser.info = "" Or IsNull(objUser.info) = True Then Sign_info = "" Else Sign_info = objUser.info End If
If objUser.title = "" Or IsNull(objUser.title) = True Then Sign_title = "" Else Sign_title = objUser.title End If
If objUser.department = "" Or IsNull(objUser.department) = True Then Sign_department = "" Else Sign_department = objUser.department End If
If objUser.company = "" Or IsNull(objUser.company) = True Then Sign_company = "" Else Sign_company = objUser.company End If
If objUser.manager = "" Or IsNull(objUser.manager) = True Then Sign_manager = "" Else Sign_manager = objUserMan.givenName & " " & objUserMan.sn End If
' TXT SIGNATURE
Set objTextFile = objFSO.OpenTextFile(SignaturePath & "OutlookSignature.txt.template", 1, False, -2)
Set objFile = objFSO.CreateTextFile(SignaturePath & "OutlookSignature.txt", True)
objFile.Close
Set objFile = objFSO.OpenTextFile(SignaturePath & "OutlookSignature.txt", 2)
Do while NOT objTextFile.AtEndOfStream
Inputline000 = objTextFile.ReadLine
Outputline01 = Replace(Inputline000,"###FIRSTNAME###",Sign_givenName)
Outputline02 = Replace(Outputline01,"###INITIALS###",Sign_initials)
Outputline03 = Replace(Outputline02,"###LASTNAME###",Sign_sn)
Outputline04 = Replace(Outputline03,"###DISPLAYNAME###",Sign_displayName)
Outputline05 = Replace(Outputline04,"###DESCRIPTION###",Sign_description)
Outputline06 = Replace(Outputline05,"###OFFICENAME###",Sign_physicalDeliveryOfficeName)
Outputline07 = Replace(Outputline06,"###TELEPHONE###",Sign_telephoneNumber)
Outputline08 = Replace(Outputline07,"###OTHERTELEPHONE###",Sign_otherTelephone)
Outputline09 = Replace(Outputline08,"###EMAIL###",Sign_mail)
Outputline10 = Replace(Outputline09,"###WEBPAGE###",Sign_wWWHomePage)
Outputline11 = Replace(Outputline10,"###OTHERWEBPAGE###",Sign_url)
Outputline12 = Replace(Outputline11,"###STREETADDRESS###",Sign_streetAddress)
Outputline13 = Replace(Outputline12,"###POSTOFFICEBOX###",Sign_postOfficeBox)
Outputline14 = Replace(Outputline13,"###CITY###",Sign_l)
Outputline15 = Replace(Outputline14,"###STATE###",Sign_st)
Outputline16 = Replace(Outputline15,"###POSTALCODE###",Sign_postalCode)
Outputline17 = Replace(Outputline16,"###COUNTRYCODE###",Sign_countryCode)
Outputline18 = Replace(Outputline17,"###HOMEPHONE###",Sign_homePhone)
Outputline19 = Replace(Outputline18,"###OTHERHOMEPHONE###",Sign_otherHomePhone)
Outputline20 = Replace(Outputline19,"###PAGER###",Sign_pager)
Outputline21 = Replace(Outputline20,"###OTHERPAGER###",Sign_otherPager)
Outputline22 = Replace(Outputline21,"###MOBILEPHONE###",Sign_mobile)
Outputline23 = Replace(Outputline22,"###OTHERMOBILEPHONE###",Sign_otherMobile)
Outputline24 = Replace(Outputline23,"###FAX###",Sign_facsimileTelephoneNumber)
Outputline25 = Replace(Outputline24,"###OTHERFAX###",Sign_otherFacsimileTelephoneNumber)
Outputline26 = Replace(Outputline25,"###IPPHONE###",Sign_ipPhone)
Outputline27 = Replace(Outputline26,"###OTHERIPPHONE###",Sign_otherIpPhone)
Outputline28 = Replace(Outputline27,"###NOTES###",Sign_info)
Outputline29 = Replace(Outputline28,"###JOBTITLE###",Sign_title)
Outputline30 = Replace(Outputline29,"###DEPARTMENT###",Sign_department)
Outputline31 = Replace(Outputline30,"###COMPANY###",Sign_company)
Outputline32 = Replace(Outputline31,"###MANAGER###",Sign_manager)
objFile.Write Trim(Outputline32) & vbCrLf
Loop
objFile.Close
objTextFile.Close
Set objTextFile = Nothing
' HTM SIGNATURE
Set objTextFile = objFSO.OpenTextFile(SignaturePath & "OutlookSignature.htm.template", 1, False, -2)
Set objFile = objFSO.CreateTextFile(SignaturePath & "OutlookSignature.htm", True)
objFile.Close
Set objFile = objFSO.OpenTextFile(SignaturePath & "OutlookSignature.htm", 2)
Do while NOT objTextFile.AtEndOfStream
Inputline000 = objTextFile.ReadLine
Outputline01 = Replace(Inputline000,"###FIRSTNAME###",Sign_givenName)
Outputline02 = Replace(Outputline01,"###INITIALS###",Sign_initials)
Outputline03 = Replace(Outputline02,"###LASTNAME###",Sign_sn)
Outputline04 = Replace(Outputline03,"###DISPLAYNAME###",Sign_displayName)
Outputline05 = Replace(Outputline04,"###DESCRIPTION###",Sign_description)
Outputline06 = Replace(Outputline05,"###OFFICENAME###",Sign_physicalDeliveryOfficeName)
Outputline07 = Replace(Outputline06,"###TELEPHONE###",Sign_telephoneNumber)
Outputline08 = Replace(Outputline07,"###OTHERTELEPHONE###",Sign_otherTelephone)
Outputline09 = Replace(Outputline08,"###EMAIL###",Sign_mail)
Outputline10 = Replace(Outputline09,"###WEBPAGE###",Sign_wWWHomePage)
Outputline11 = Replace(Outputline10,"###OTHERWEBPAGE###",Sign_url)
Outputline12 = Replace(Outputline11,"###STREETADDRESS###",Sign_streetAddress)
Outputline13 = Replace(Outputline12,"###POSTOFFICEBOX###",Sign_postOfficeBox)
Outputline14 = Replace(Outputline13,"###CITY###",Sign_l)
Outputline15 = Replace(Outputline14,"###STATE###",Sign_st)
Outputline16 = Replace(Outputline15,"###POSTALCODE###",Sign_postalCode)
Outputline17 = Replace(Outputline16,"###COUNTRYCODE###",Sign_countryCode)
Outputline18 = Replace(Outputline17,"###HOMEPHONE###",Sign_homePhone)
Outputline19 = Replace(Outputline18,"###OTHERHOMEPHONE###",Sign_otherHomePhone)
Outputline20 = Replace(Outputline19,"###PAGER###",Sign_pager)
Outputline21 = Replace(Outputline20,"###OTHERPAGER###",Sign_otherPager)
Outputline22 = Replace(Outputline21,"###MOBILEPHONE###",Sign_mobile)
Outputline23 = Replace(Outputline22,"###OTHERMOBILEPHONE###",Sign_otherMobile)
Outputline24 = Replace(Outputline23,"###FAX###",Sign_facsimileTelephoneNumber)
Outputline25 = Replace(Outputline24,"###OTHERFAX###",Sign_otherFacsimileTelephoneNumber)
Outputline26 = Replace(Outputline25,"###IPPHONE###",Sign_ipPhone)
Outputline27 = Replace(Outputline26,"###OTHERIPPHONE###",Sign_otherIpPhone)
Outputline28 = Replace(Outputline27,"###NOTES###",Sign_info)
Outputline29 = Replace(Outputline28,"###JOBTITLE###",Sign_title)
Outputline30 = Replace(Outputline29,"###DEPARTMENT###",Sign_department)
Outputline31 = Replace(Outputline30,"###COMPANY###",Sign_company)
Outputline32 = Replace(Outputline31,"###MANAGER###",Sign_manager)
objFile.Write Trim(Outputline32) & vbCrLf
Loop
objFile.Close
objTextFile.Close
Set objTextFile = Nothing
' REMOVE TEMPORARY FILES
If objFSO.FileExists(SignaturePath & "OutlookSignature.htm.template") = True Then objFSO.DeleteFile SignaturePath & "OutlookSignature.htm.template" End If
If objFSO.FileExists(SignaturePath & "OutlookSignature.txt.template") = True Then objFSO.DeleteFile SignaturePath & "OutlookSignature.txt.template" End If
' AUTOMATIC ACTIVATION
If objFSO.FileExists(SignaturePath & "OutlookSignature.txt") Then
keyPath = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
if objRegistry.EnumKey(&H80000001, keyPath, valueNames1) = 0 then
if isArray(valueNames1) then
for i1 = 0 to UBound(valueNames1)
if objRegistry.EnumKey(&H80000001, keyPath & "\" & valueNames1(i1), valueNames2) = 0 then
if isArray(valueNames2) then
for i2 = 0 to UBound(valueNames2)
if objRegistry.EnumKey(&H80000001, keyPath & "\" & valueNames1(i1) & "\" & valueNames2(i2), valueNames3) = 0 then
if isArray(valueNames3) then
for i3 = 0 to UBound(valueNames3)
If InStr(valueNames3(i3),"0000") > 0 Then
If OutlookSignatureFirsNew = 1 Then objRegistry.SetBinaryValue &H80000001, keyPath & "\" & valueNames1(i1) & "\" & valueNames2(i2) & "\" & valueNames3(i3), "New Signature", OutlookSignatureBinName End If
If OutlookSignatureFirsRep = 1 Then objRegistry.SetBinaryValue &H80000001, keyPath & "\" & valueNames1(i1) & "\" & valueNames2(i2) & "\" & valueNames3(i3), "Reply-Forward Signature", OutlookSignatureBinName End If
SetRegCounter = SetRegCounter + 1
End If
next
end if
end if
next
end if
end if
next
end if
end if
keyPath = "Software\Microsoft\Office"
if objRegistry.EnumKey(&H80000001, keyPath, valueNames1) = 0 then
if isArray(valueNames1) then
for i1 = 0 to UBound(valueNames1)
if objRegistry.EnumKey(&H80000001, keyPath & "\" & valueNames1(i1) & "\Outlook\Profiles", valueNames2) = 0 then
if isArray(valueNames2) then
for i2 = 0 to UBound(valueNames2)
if objRegistry.EnumKey(&H80000001, keyPath & "\" & valueNames1(i1) & "\Outlook\Profiles\" & valueNames2(i2), valueNames3) = 0 then
if isArray(valueNames3) then
for i3 = 0 to UBound(valueNames3)
if objRegistry.EnumKey(&H80000001, keyPath & "\" & valueNames1(i1) & "\Outlook\Profiles\" & valueNames2(i2) & "\" & valueNames3(i3), valueNames4) = 0 then
if isArray(valueNames4) then
for i4 = 0 to UBound(valueNames4)
If InStr(valueNames4(i4),"0000") > 0 Then
If OutlookSignatureFirsNew = 1 Then objRegistry.SetBinaryValue &H80000001, keyPath & "\" & valueNames1(i1) & "\Outlook\Profiles\" & valueNames2(i2) & "\" & valueNames3(i3) & "\" & valueNames4(i4), "New Signature", OutlookSignatureBinName End If
If OutlookSignatureFirsRep = 1 Then objRegistry.SetBinaryValue &H80000001, keyPath & "\" & valueNames1(i1) & "\Outlook\Profiles\" & valueNames2(i2) & "\" & valueNames3(i3) & "\" & valueNames4(i4), "Reply-Forward Signature", OutlookSignatureBinName End If
SetRegCounter = SetRegCounter + 1
End If
next
end if
end if
next
end if
end if
next
end if
end if
objRegistry.DeleteValue &H80000001, keyPath & "\" & valueNames1(i1) & "\Outlook\Setup", "First-Run"
next
end if
end if
Set objFile = objFSO.CreateTextFile(SignatureFrst, True)
objFile.Close
Else
If objFSO.FolderExists(SignaturePath & "OutlookSignature_files") = True Then objFSO.DeleteFolder SignaturePath & "OutlookSignature_files" End If
If objFSO.FileExists(SignaturePath & "OutlookSignature.htm") = True Then objFSO.DeleteFile SignaturePath & "OutlookSignature.htm" End If
If objFSO.FileExists(SignaturePath & "OutlookSignature.txt") = True Then objFSO.DeleteFile SignaturePath & "OutlookSignature.txt" End If
If objFSO.FileExists(SignaturePath & "OutlookSignature.rtf") = True Then objFSO.DeleteFile SignaturePath & "OutlookSignature.rtf" End If
End If
End If
' FORCE RE-ACTIVATION
If objFSO.FileExists(SignatureFrst) = True Or objFSO.FileExists(SignatureFlag) = True Then
WScript.Sleep 60000
keyPath = "Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
if objRegistry.EnumKey(&H80000001, keyPath, valueNames1) = 0 then
if isArray(valueNames1) then
for i1 = 0 to UBound(valueNames1)
if objRegistry.EnumKey(&H80000001, keyPath & "\" & valueNames1(i1), valueNames2) = 0 then
if isArray(valueNames2) then
for i2 = 0 to UBound(valueNames2)
if objRegistry.EnumKey(&H80000001, keyPath & "\" & valueNames1(i1) & "\" & valueNames2(i2), valueNames3) = 0 then
if isArray(valueNames3) then
for i3 = 0 to UBound(valueNames3)
If InStr(valueNames3(i3),"0000") > 0 Then
If (OutlookSignatureFirsNew = 1 And OutlookSignatureRefrNew = 1) Or objFSO.FileExists(SignatureFrst) = True Then objRegistry.SetBinaryValue &H80000001, keyPath & "\" & valueNames1(i1) & "\" & valueNames2(i2) & "\" & valueNames3(i3), "New Signature", OutlookSignatureBinName End If
If (OutlookSignatureFirsRep = 1 And OutlookSignatureRefrRep = 1) Or objFSO.FileExists(SignatureFrst) = True Then objRegistry.SetBinaryValue &H80000001, keyPath & "\" & valueNames1(i1) & "\" & valueNames2(i2) & "\" & valueNames3(i3), "Reply-Forward Signature", OutlookSignatureBinName End If
SetRegCounter = SetRegCounter + 1
End If
next
end if
end if
next
end if
end if
next
end if
end if
keyPath = "Software\Microsoft\Office"
if objRegistry.EnumKey(&H80000001, keyPath, valueNames1) = 0 then
if isArray(valueNames1) then
for i1 = 0 to UBound(valueNames1)
if objRegistry.EnumKey(&H80000001, keyPath & "\" & valueNames1(i1) & "\Outlook\Profiles", valueNames2) = 0 then
if isArray(valueNames2) then
for i2 = 0 to UBound(valueNames2)
if objRegistry.EnumKey(&H80000001, keyPath & "\" & valueNames1(i1) & "\Outlook\Profiles\" & valueNames2(i2), valueNames3) = 0 then
if isArray(valueNames3) then
for i3 = 0 to UBound(valueNames3)
if objRegistry.EnumKey(&H80000001, keyPath & "\" & valueNames1(i1) & "\Outlook\Profiles\" & valueNames2(i2) & "\" & valueNames3(i3), valueNames4) = 0 then
if isArray(valueNames4) then
for i4 = 0 to UBound(valueNames4)
If InStr(valueNames4(i4),"0000") > 0 Then
If (OutlookSignatureFirsNew = 1 And OutlookSignatureRefrNew = 1) Or objFSO.FileExists(SignatureFrst) = True Then objRegistry.SetBinaryValue &H80000001, keyPath & "\" & valueNames1(i1) & "\Outlook\Profiles\" & valueNames2(i2) & "\" & valueNames3(i3) & "\" & valueNames4(i4), "New Signature", OutlookSignatureBinName End If
If (OutlookSignatureFirsRep = 1 And OutlookSignatureRefrRep = 1) Or objFSO.FileExists(SignatureFrst) = True Then objRegistry.SetBinaryValue &H80000001, keyPath & "\" & valueNames1(i1) & "\Outlook\Profiles\" & valueNames2(i2) & "\" & valueNames3(i3) & "\" & valueNames4(i4), "Reply-Forward Signature", OutlookSignatureBinName End If
SetRegCounter = SetRegCounter + 1
End If
next
end if
end if
next
end if
end if
next
end if
end if
If OutlookSignatureRefrNew = 1 Or OutlookSignatureRefrRep = 1 Or objFSO.FileExists(SignatureFrst) = True Then objRegistry.DeleteValue &H80000001, keyPath & "\" & valueNames1(i1) & "\Outlook\Setup", "First-Run" End If
next
end if
end if
End If
' END
If objFSO.FileExists(SignatureFrst) = True Then objFSO.DeleteFile SignatureFrst End If
If SetRegCounter > 0 Then Set objFile = objFSO.CreateTextFile(SignatureFlag, True) End If
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing
Set objUser = Nothing
Set objSysInfo = Nothing
Set oShell = Nothing