cholmskov
asked on
Signature Creator via HTA
Hello again EE and especially my "mentor" RobSampsom :D
Once again I have run into a question that, while the solution may be out there like little green men, it's by far easier to ask the experts.
I have made a VBS script that creates HTML signatures with images that are used in Lotus Notes, unfortunately they are not very fancy, since it requires a ton of popup boxes to be filled out and wont show the finished signature until you are done.
So here is my request.
A way to have an inputbox where you enter text and have what you enter be showed WITH formatting in the same window, to the side or similar.
Such as if I was making a signature, I would put "MyFirstname MyLastName" into an input box called Name and on the right side (or below) in the HTA frame, it would show MyFirstName MyLastName with the HTML formatting that I have entered, so I can see step by step how my signature would look when done, when adding titles, numbers, addresses and so on.
It also needs to be able to have a select box which will pull a .gif or .jpg file from the server which is once again used for the formatting.
I have attached my VBS script below so you can see what it is I want changed into a HTA that will show the changes as they are done.
Hope it's possible
Once again I have run into a question that, while the solution may be out there like little green men, it's by far easier to ask the experts.
I have made a VBS script that creates HTML signatures with images that are used in Lotus Notes, unfortunately they are not very fancy, since it requires a ton of popup boxes to be filled out and wont show the finished signature until you are done.
So here is my request.
A way to have an inputbox where you enter text and have what you enter be showed WITH formatting in the same window, to the side or similar.
Such as if I was making a signature, I would put "MyFirstname MyLastName" into an input box called Name and on the right side (or below) in the HTA frame, it would show MyFirstName MyLastName with the HTML formatting that I have entered, so I can see step by step how my signature would look when done, when adding titles, numbers, addresses and so on.
It also needs to be able to have a select box which will pull a .gif or .jpg file from the server which is once again used for the formatting.
I have attached my VBS script below so you can see what it is I want changed into a HTA that will show the changes as they are done.
Hope it's possible
' Created by Carsten Holmskov (BDCAR)
'Defines System Object to be used for the script
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Defines the different objects to be used for copying of correct image file
Set ObjBBSEMEA = ObjFSO.GetFile("\\Server\program\MailSignLogo\bbs_Emea.jpg")
Set ObjBSP = ObjFSO.GetFile ("\\Server\program\MailsignLogo\bsp.jpg")
Set ObjBCS = ObjFSO.Getfile ("\\Server\program\mailsignlogo\bcs.jpg")
Set ObjDC = ObjFSO.GetFile ("\\Server\program\mailsignlogo\DC.gif")
Set ObjBHC = ObjFSO.GetFile ("\\Server\program\mailsignlogo\Companylogo.gif")
Set ObjBBS = ObjFSO.GetFile ("\\Server\program\mailsignlogo\Companylogo.gif")
Set ObjBMS = ObjFSO.GetFile ("\\Server\program\mailsignlogo\bmslogo.gif")
Set ObjGuide = ObjFSO.GetFile ("\\Server\program\mailsignlogo\SignatureGuide.doc")
'Creates the Text File that will be used as the HTML file, saved as .html
If Not ObjFSO.FolderExists ("C:\program files\lotus\notes\signature") Then
ObjFSO.CreateFolder "c:\program files\lotus\notes\Signature"
End If
Set ObjFile = ObjFSO.CreateTextFile("c:\program files\lotus\notes\Signature\Signature.html")
'Defines where the strScriptFile is pointing to
strScriptFile = "c:\program files\lotus\notes\Signature\Signature.html"
'Defines the HTML setup for the image
strSCR = ("<IMG SRC=")
strSize = ("WIDTH=""320"" HEIGHT=""56"" BORDER=0 ALT=""""><br>")
'Defines that strQuote is a "
strQuote = (chr(34)):
'Defines where the image should be copied
strImgLoc = "c:\program files\lotus\notes\Signature\"
'Makes an InputBox that queries you for your subgroup, then takes the number you have pressed and defines which image file to copy
strSubGroup = InputBox("Please press the number corresponding with your Subgroup/Division:" & vbCrlf & "1=BCS, AH or CC" & vbCrlf & "2=BBS" & vbCrlf & "3=BSP" & vbCrlf & "4=Corporate Services" & vbCrlf & "5=DC" & vbCrlf & "6=BMS" & vbCrlf & "7=BBS-EMEA", "Department")
If strSubGroup= "1" Then
objBMS.Copy StrImgLoc
objGuide.Copy strImgLoc
strImg = ("Companylogo.gif")
Elseif strSubGroup= "2" Then
objBBS.Copy StrImgLoc
objGuide.Copy strImgLoc
strImg = ("Companylogo.gif")
Elseif strSubGroup= "3" Then
objBSP.Copy StrImgLoc
objGuide.Copy strImgLoc
strImg = ("bsp.jpg")
Elseif strSubGroup= "4" Then
objBCS.Copy StrImgLoc
objGuide.Copy strImgLoc
strImg = ("bcs.jpg")
Elseif strSubGroup= "5" Then
objDC.Copy StrImgLoc
objGuide.Copy strImgLoc
strImg = ("dc.gif")
Elseif strSubGroup= "6" Then
objBMS.Copy StrImgLoc
objGuide.Copy strImgLoc
strImg = ("bmslogo.gif")
Elseif strSubGroup= "7" Then
objBBSEMEA.Copy StrImgLoc
objGuide.Copy strImgLoc
strImg = ("bbs_emea.jpg")
Else Wscript.Echo "No subgroup was selected, Please restart the script"
Wscript.Quit
End If
'Defines the HTML structure of the signature
ObjFile.Writeline ("<html>")
ObjFile.Writeline ("<head>")
ObjFile.Writeline ("<body>")
ObjFile.Writeline ("<font face=verdana size=2 color=#000000>")
ObjFile.Writeline strbr & strbr & strbr
ObjFile.Writeline ("Med venlig hilsen / Best regards<br>")
'Defines that strBR is the linebreak char in html <br>
strBR = ("<br>")
strName = InputBox("Please enter your full name:", "Name")
If strName = "" Then
Wscript.Echo "No name entered"
Else ObjFile.Writeline strName & strBR
End If
ObjFile.Writeline strBR
ObjFile.Writeline ("</font>")
ObjFile.Writeline ("<font face=verdana size=1 color=#999999>")
ObjFile.Writeline ("_____________________________________________________")
ObjFile.Writeline strBR
ObjFile.Writeline strScr & " " & strQuote & strImg & strQuote & " " & strBR
ObjFile.Writeline strBR
strTeam = InputBox("Please enter your Department or Subgroup" & vbCrlf & vbCrlf & "I.e BBS-EMEA or BHC-BSP-PC" & vbCrlf & vbCrlf & "Press Enter to leave blank", "Department")
If Not strTeam = "" Then
ObjFile.Writeline strTeam & strBR
End If
strTitle = InputBox("Please enter your Title" & vbCrlf & vbCrlf & "I.e Global Account Manager" & vbCrlf & vbCrlf & "Press Enter To leave blank", "Title")
If Not strTitle = "" Then
ObjFile.Writeline StrTitle & strBR
End If
ObjFile.Writeline "Noergaardsvej 32, 2800 Kgs.Lyngby, Denmark" & strBR
strPhone = InputBox("Please enter your Office Phone Number:" & vbCrlf & vbCrlf & "I.e +45 45235000", "Phone")
If Not strPhone = "" Then
ObjFile.Writeline ("Office Phone: " & strPhone & strBR)
End If
strMobile = InputBox("Please enter your Mobile Number:" & vbCrlf & vbCrlf & "I.e +45 40404040", "Mobile")
If Not strPhone = "" Then
ObjFile.Writeline ("Mobile Phone: " & strMobile & strBR)
End If
strEmail = InputBox("Please enter your Email Address:" & vbCrlf & vbCrlf & "I.e Carsten.Holmskov@Companybbs.com", "Email")
If Not strEmail = "" Then
ObjFile.Writeline ("E-Mail:" & strEmail & strBR)
End If
ObjFile.Writeline ("</font>")
ObjFile.Writeline ("</Body>")
ObjFile.Writeline ("</Head>")
ObjFile.Writeline ("</html>")
Sub Run(Byval sFile)
Dim shell
Set shell = CreateObject("WScript.Shell")
shell.Run Chr(34) & sFile & Chr(34), 1, False
Set shell = Nothing
End Sub
strResponse = MsgBox("Do you want help installing your new signature ? ?", vbYesno, "Confirm View")
If strResponse = vbYes Then
' Execute the file
Run "C:\Program Files\Lotus\notes\signature\SignatureGuide.doc"
Else Wscript.quit
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Bloody great work, it looks cool and is easy to edit :)
No problem Carsten. I did notice that there is one small mistake in it....it does copy the image to the Signature folder, but it does not *use* that image, in the HTML page.
All that should be needed to fix that issue, is, change these lines:
span_html.InnerHTML = strHTML
txt_actualHTML.Value = strHTML
'Defines where the image should be copied
strImgLoc = "c:\program files\lotus\notes\Signatur e\"
to this:
'Defines where the image should be copied
strImgLoc = "c:\program files\lotus\notes\Signatur e\"
span_html.InnerHTML = strHTML
txt_actualHTML.Value = Replace(strHTML, arrImages(CInt(lst_subgrou p.Value) - 1), strImgLoc & Mid(arrImages(CInt(lst_sub group.Valu e) - 1), InStrRev(arrImages(CInt(ls t_subgroup .Value) - 1), "\") + 1))
Also, which version of Lotus Notes clients are you using? I use R5 and R7, but I don't think those are registry contolled....you might be able to configure those clients using the Notes.INI file, but I beleive only R8 is registry controlled, and therefore policy controlled by the server console anyway.....which we'll get to in the next few months :-)
Regards,
Rob.
All that should be needed to fix that issue, is, change these lines:
span_html.InnerHTML = strHTML
txt_actualHTML.Value = strHTML
'Defines where the image should be copied
strImgLoc = "c:\program files\lotus\notes\Signatur
to this:
'Defines where the image should be copied
strImgLoc = "c:\program files\lotus\notes\Signatur
span_html.InnerHTML = strHTML
txt_actualHTML.Value = Replace(strHTML, arrImages(CInt(lst_subgrou
Also, which version of Lotus Notes clients are you using? I use R5 and R7, but I don't think those are registry contolled....you might be able to configure those clients using the Notes.INI file, but I beleive only R8 is registry controlled, and therefore policy controlled by the server console anyway.....which we'll get to in the next few months :-)
Regards,
Rob.
ASKER
We are using Notes R6 and im afraid you are right, it does not allow it to be modified neither by registry nor by the ini file.
It seems the location where it's specified is part of the coding and as such cannot be modified in a simple fashion *sigh*
And yeah I did notice that, I managed to manually circumvent it, but i'll replace it with the above for a easier-to-modify solution for the future.
Thanks once again Rob, I really love this little thing :D
It seems the location where it's specified is part of the coding and as such cannot be modified in a simple fashion *sigh*
And yeah I did notice that, I managed to manually circumvent it, but i'll replace it with the above for a easier-to-modify solution for the future.
Thanks once again Rob, I really love this little thing :D
ASKER
And yeah it has worked great with pure VBS popup's, but why not improve when possible :)
Im currently trying to find a way to have notes automatically use the signature, but so far no luck.
It should be possible, once I find where in the registry you set to activate HTML signatures and define the path :)