Jump to content
water

OutlookEX UDF

Recommended Posts

Hi AutoITSM,

the problem is - as I mentioned in my previous post - that the password property can't be accessed using the Outlook object model.

The only way to solve the problem is to start a second script, wait for the password GUI to appear and enter the password. A good example is the _OL_Warnings.au3

OK.I see.

Now by another way,I first determine whether the outlook has been opened,as follows:

Func if_OLOPEN()

If ProcessExists("Outlook.exe")=0 Then

MsgBox(262192,"HIN","OUTLOOK Hasn't been opened! Please open OUTLOOK manually!")

Exit

Else

$OL_Handle = _OL_Open()

Return $OL_Handle

EndIf

EndFunc

This method is a little stupid, if there are other ways, Please tell me.

Share this post


Link to post
Share on other sites

Hi AutoITSM,

the problem is - as I mentioned in my previous post - that the password property can't be accessed using the Outlook object model.

The only way to solve the problem is to start a second script, wait for the password GUI to appear and enter the password. A good example is the _OL_Warnings.au3

Sorry for trouble you again,but i have another question need you to resolve.

$oItem = _OL_ItemCreate($oOutlook, $olMailItem, "Outlook-UDF-Test\SourceFolder\mail", "", "Subject=TestMail", "BodyFormat=" & $olFormatHTML, "HTMLBody=Bodytext in <b>bold</b>.")

For the HTMLBody property, How to write a line break?

I tried like< "HTMLBody=123"&@CRLF&"456"> ,but the string "123" and "456" are still in the sam row.

SO i changed the line 2144 and 2145 like belows:

$oOL_Item.ItemProperties.Item(StringStripWS(StringLeft($aOL_Properties[$iOL_Index], $iOL_Pos - 1), 3) ).value = _

StringMid($aOL_Properties[$iOL_Index], $iOL_Pos + 1)

(delete the second StringStripWS function) and it is not working.

Please help...thx again

Edited by AutoITSM

Share this post


Link to post
Share on other sites

For the HTMLBody property, How to write a line break?

I tried like< "HTMLBody=123"&@CRLF&"456"> ,but the string "123" and "456" are still in the sam row.

SO i changed the line 2144 and 2145 like belows:

$oOL_Item.ItemProperties.Item(StringStripWS(StringLeft($aOL_Properties[$iOL_Index], $iOL_Pos - 1), 3) ).value = _

StringMid($aOL_Properties[$iOL_Index], $iOL_Pos + 1)

(delete the second StringStripWS function) and it is not working.

Please help...thx again

Hi AutoITSM,

...

Ha,i solved the problem.

So is HTML syntax, just use </br> .

Just like "HTMLBody=123</br>456"

I understand it a little bit inside the principle of. Thank you agan.

Share this post


Link to post
Share on other sites

Please have a look at the code of _OL_Open and _OL_Close (if you like).

_OL_Open checks if Outlook is already running. If Outlook is already started a global variable ($fOL_AlreadyRunning) is set. _OL_Close shuts down Outlook only if it has been started by _OL_Open. Or you can set parameter $fOL_ForceClose to True then Outlook is closed anyway.

So you don't have to check if Outlook is already running, just call _OL_Open and _OL_Close.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Ha,i solved the problem.

So is HTML syntax, just use </br> .

Just like "HTMLBody=123</br>456"

I understand it a little bit inside the principle of. Thank you agan.

It's HTML syntax, that's true. Every HTML tag has an opening and a closing form. The closing form has a slash after the left bracket.

Example: "Write this text in bold" would be in HTML "Write this text in <b>bold</b>"

In your case "</br>" is the closing tag - but a line break doesn't need a closing tag. Correct would be "<br>".


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

It's HTML syntax, that's true. Every HTML tag has an opening and a closing form. The closing form has a slash after the left bracket.

Example: "Write this text in bold" would be in HTML "Write this text in <b>bold</b>"

In your case "</br>" is the closing tag - but a line break doesn't need a closing tag. Correct would be "<br>".

Thank you very much,i learned so much~:)

Share this post


Link to post
Share on other sites

Version 0.4.0 has been released.

Please test before using in production!

For download please see my signature.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I have been looking through the Outlook UDF's for a script that supports a process which simply saves any file/s attached to an email to default folder and then on completion of that process delete the email and its attachment. I am ok with most of the prcoesses however the method of dealing with the attachment escapes me. If you can point me in the right direction that would be very much appreciated. Ant.. :mellow:

Share this post


Link to post
Share on other sites

This could be done with a script like this one. Please change line 2 and 3 so you get the object/EntryID of the mail item to process.

$oOL = _OL_Open()
$aItems = _OL_ItemFind($oOL, ....)
$oOL_Item = $aItems...
_OL_ItemSave($oOL, $oOL_Item, Default, "C:\Temp\", $olTXT, 2)
If @error Then Exit MsgBox(16, "OutlookEX Example Script", "Error saving attachments: @error = " & @error & ", @extended = " & @extended)
_OL_ItemDelete($oOL, $oOL_Item)
If @error Then Exit MsgBox(16, "OutlookEX Example Script", "Error deleting mail item: @error = " & @error & ", @extended = " & @extended)
_OL_Close($oOL)
Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi Guys, I'm kind of new to AutoIt and have only done some basic scripts with AutoIt which I think is amazing! (had to be said :mellow: ). I was thinking a project to work on and I had the idea of using AutoIt to move emails in my mailbox to their appropriate folders in Outlook based on the domain of the sender. Did some googling and found your OutlookEX.au3 which I am very impressed with.

I am struggling with how to access the inbox and then gather the sender email address from the email currently focused on. If you point me in the write direction I would really appreciate it.

Cheers

Sath

Share this post


Link to post
Share on other sites

Use something like:

#include <OutlookEx.au3>
$oOL = _OL_Open() ; Connect to Outlook
$aSelectedItems = _OL_FolderSelectionGet($oOL) ; Get the selected items from the active explorer
$aOL_Properties = _OL_ItemGet($oOL, $aSelectedItems[1][0], Default, "SenderEmailAddress") ; Get the SenderEmailAddress property of the first selected item
You have to make sure that the user selects the inbox and a mail item you want to process.

Or you could use Outlook events.

Please have a look at the _OL_Test_NewMail_Event.au3 shows how to handle events.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Version 0.5.0 has been released.

Please test before using in production!

For download please see my signature.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Hi water,

firstly apologies for posting in the wrong area, secondly thank you for the reply.

I managed to produce a similar result by using _OL_ItemFind.

Thanks for your assistance.

Share this post


Link to post
Share on other sites

Glad you got it working :graduated:


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

my profile in computer is in hebrew. when i try using _OL_PSTGet function my profile name is get bad characters. see the screanshot:

post-61541-0-56115900-1316593284_thumb.j

Share this post


Link to post
Share on other sites

I hope this is only a presentation problem (code page) :graduated:

What do you do with the returned path (what functuions etc. do you call) and do you get any errors when you use the pathname?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Why do you want to open the PST using explorer.exe?

The PST is already accessed by Outlook so you can do whatever you want using the UDF functions.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2019-10-24 - Version 1.4.14.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2019-11-30 - Version 1.4.0.0) - Download - General Help & Support - Example Scripts - Wiki
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (NEW 2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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

×
×
  • Create New...