Page 1 of 1 1
Topic Options
#204258 - 2012-02-10 09:51 AM Outlook signature and pictures
Snowball78 Offline
Just in Town

Registered: 2012-02-09
Posts: 2
Loc: Denmark
Hi
I have a problem with my kix script. I want to make an outlook signature with a picture. The picture are in the left and the text ind the right side.
Then the picture are insterted it's over or undr the text.

How do I fix that?

 Code:
;Set Break to on if the script is not running at logon.
;This will prevent you being logged of when testing this script and closing
;it when it's running.
If NOT @LOGONMODE
	Break on
EndIf

;Call the readfile UDF.
;This UDF is used later in the script.
Call @LDRIVE + "\functions\readfile().udf"

;Delete all existing signatures.
;Stuff can change. Therefore the signatures are
;deleted and recreated each time.
$appdata = ExpandEnvironmentVars(%appdata%)
Del $appdata + "\Microsoft\Signatures\*.*"

;Get data from AD
;Open ADSystemInfo object
$objSysInfo = CreateObject("ADSystemInfo")
;Get the username from AD.
$strUser 	= $objSysInfo.UserName
;Get the users deatils using LDAP.
$objUser	= GetObject("LDAP://" + $strUser)
;Get the users full name.
$strName 		= $objUser.FullName
;Get the users title.
$strTitle 		= $objUser.Title
;Get the users default reply e-mail address.
$strMail 		= $objUser.mail
;Get the users department.
$strDepartment = $objUser.Department
;Get the users company name.
$strCompany 	= $objUser.Company
;Get the users street address.
$strStreet		= $objUser.StreetAddress
;Get the users postal code.
$strPostalCode	= $objUser.PostalCode
;Get the users city.
$strCity 		= $objUser.L
;Get the users country.
$strCountry 	= $objUser.Co
;Get the users phone number.
$strPhone 		= $objUser.telephoneNumber
;Get the users fax number.
$strFax		 	= $objUser.FacsimileTelephoneNumber
;Get the users mobile phone number
$strMobile		= $objUser.Mobile
;Get the users homepage.
$strWeb		 	= $objUser.wWWHomePage

;Read the contents of the news text file using the
;readfile UDF called at the top of the script.
;$strNews = ReadFile(@LDRIVE + "\tools\News.txt")


;Initialize word to write the signature.
$objWord = CreateObject("Word.Application")
;Add a document to word and set various options.
$objDoc = $objWord.Documents.Add()
$objSelection = $objWord.Selection
$objEmailOptions = $objWord.EmailOptions
$objSignatureObject = $objEmailOptions.EmailSignature
$objSignatureEntries = $objSignatureObject.EmailSignatureEntries

;Write signature.
;Set font to use in the signature.
$objSelection.Font.Name = "Calibri"
;Set the font size.
$objSelection.Font.Size = "11"
;Set the colour of the following text.
$objSelection.Font.Color = "8421504"
$objSelection.Font.Bold = "0"
;Write text.

$objSelection.TypeText("Med Venlig hilsen/Best Regards")
$objSelection.TypeText(Chr(11))
;Write text.
$objSelection.TypeText(Chr(11))
$objSelection.Font.Bold = "1"
;Write text and use the variables filled when retrieving data from AD.
$objSelection.TypeText($strName)

;Set font size.
$objSelection.Font.Size = "11"
$objSelection.Font.Bold = "0"
$objSelection.TypeText(Chr(11))
$objSelection.TypeText($strTitle)

$objSelection.TypeText(Chr(11))

$objShape = $objSelection.InlineShapes.AddPicture("\\Server\Netlogon\Logo_Streg.jpg")

;Write text and use the variables filled when retrieving data from AD.
;$objSelection.TypeText($strCompany)
;Write a "soft" enter. Just like br in HTML.

If ($strMobile <> "")
	$objSelection.TypeText(Chr(11))
	$objSelection.TypeText("Mobil:     " + $strMobile)
EndIf

If ($strPhone <> "")
	$objSelection.TypeText(Chr(11))
	$objSelection.TypeText("Direkte:  " + $strPhone)
EndIf

If ($strFax <> "")
	$objSelection.TypeText(Chr(11))
	$objSelection.TypeText("Fax:          " + $strFax)
EndIf



$objSelection.TypeText(Chr(11))
;Write text and use the variables filled when retrieving data from AD.
$objSelection.TypeText("E-mail:    " + $strmail)
;Write a "soft" enter. Just like br in HTML.
$objSelection.TypeText(Chr(11))

$objShape = $objSelection.InlineShapes.AddPicture("\\\Server\Netlogon\Logo_Streg.jpg")

If ($strStreet <> "")
	$objSelection.TypeText(Chr(11))
	$objSelection.TypeText("" + $strStreet)
EndIf


If ($strweb <> "")
	$objSelection.TypeText(Chr(11))
	$objSelection.TypeText("" + $strweb)
EndIf



$objSelection.TypeText(Chr(11))

$objShape = $objSelection.InlineShapes.AddPicture("\\Server\Netlogon\Picture.jpg")

$objSelection.TypeText(Chr(11))

;Write a news message to the signature..
;If there is no news the news file will be empty ($strNews[0] will be empty) or
;the news file does not exist (Ubound($strNews) will be -1).
;Skip the news part the file does not exist or write nothing if the first line is empty.
;If Ubound($strNews) <> "-1"
;	;Strip leadign and trailing spaces from ech line in the $strNews variable.
;	For $i = 0 to Ubound($strNews)
;		$strNews[$i] = Trim($strNews[$i])
;	Next
;	If $strNews[0] <> ""
;		;Set font style. 1 = bold, 0 = regular.
;		$objSelection.Font.Bold = "1"
;		;Set the colour of the following text.
;		$objSelection.Font.Color = "26367"
;		;Set the font size.
;		$objSelection.Font.Size = "10"
;		;Write text.
;		$objSelection.TypeText("News:")
;		;Set the font size.
;		$objSelection.Font.Size = "9"
;		;Set font style. 1 = bold, 0 = regular.
;		$objSelection.Font.Bold = "0"
;		;Write a "soft" enter. Just like br in HTML.
;		$objSelection.TypeText(Chr(11))
;		;Write each line from the $strNews variable.
;		;$strNews is an array so it gets written line by line (element by element).
;		;$i is used as an index counter to tell the scrip what line it should write.
;		;$i starts out as 0 and ends up as the largest element of the array.
;		For $i = 0 to Ubound($strNews)
;			;Set the color of the folowing text.
;			$objSelection.Font.Color = "8421504"
;			;Write the line from $strNews given by the index.
;			$objSelection.TypeText($strNews[$i])
;			;Write a "soft" enter. Just like br in HTML.
;			$objSelection.TypeText(Chr(11))
;		Next
;	EndIf
;EndIf

$objSelection = $objDoc.Range()

;Add signature.
;You could change @FULLNAME to whatever you want. Just be sure to change it the same on the
;two parts below where outlook is told to use or not use a signature on the different types of messages.
$objSignature = $objSignatureEntries.Add(@FULLNAME, $objSelection)


;Set outlook to use the signatures on each new message.
$objSignatureObject.NewMessageSignature = @FULLNAME
;$objSignatureObject.NewMessageSignature = ""
;Switch the ; on the two lines above to use no signature on new messages.

;Set outlook to use the signatures on each reply message.
$objSignatureObject.ReplyMessageSignature = @FULLNAME
;$objSignatureObject.ReplyMessageSignature = ""
;Switch the ; on the two lines above to use no signature on reply messages.

;Save the signature and quit word
$objDoc.Saved = 1
$objWord.Quit


Edited by Mart (2012-02-10 09:58 AM)
Edit Reason: Please use code tags when posting code.

Top
#204264 - 2012-02-10 01:12 PM Re: Outlook signature and pictures [Re: Snowball78]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4400
Loc: New Jersey
Welcome to Korg..

Have you seen the Outlook Signature tool that's posted in the vault? It uses an HTML template to provide accurate text and image rendering. HTML, & Text signatures can be created without a dependence on MS-Word.

I've deployed this to a travel agency where the sig uses a file-server based image that changes every week based on the current promotion without user interaction. There are templates available with images to the left, right, above, and below.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#204265 - 2012-02-10 02:03 PM Re: Outlook signature and pictures [Re: Glenn Barnas]
Snowball78 Offline
Just in Town

Registered: 2012-02-09
Posts: 2
Loc: Denmark
Thank you. Is it not possible to use my script or do I have to use html?
Please help me.


Edited by Snowball78 (2012-02-12 07:58 PM)

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 323 anonymous users online.
Newest Members
Audio, Hoschi, Comet, rrosell, PatrickPinto
17880 Registered Users

Generated in 0.122 seconds in which 0.095 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org