Jump to content

OutlookEX UDF - Help & Support


Recommended Posts

Looks like a problem with Outlook itself:

"Outlook Error 800401f3: Invalid Class String

These errors can indicate that scripting support is disabled or damaged in your Outlook installation. If Outlook was installed without scripting support, the following steps will fix the problem:"

Link how to solve the problem.

Does this make any sense?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

;)

A repair of Outlook 2010 did the trick, although I now get the security message prompting to allow the .exe access to Outlook (but I can live with that).

Thanks for all your help.

Edited by mdcastle
Link to comment
Share on other sites

You know that you can pass a parameter to _OL_Open to start a program to automatically click away security warnings?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

The UDF comes with a _OL_Warnings.au3 which has to be compiled and then needs to be called from _OL_Open.

_OL_Warnings looks for windows with title "Microsoft Office Outlook" (< Outlook 2007) or "Microsoft Outlook" (>= Outlook 2007) and a text of "A program is trying to". If it is found it clicks the messages away.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 2 weeks later...

Hi water

When using _OL_ItemSend, is

$oForward1.Display
required for the email to be sent? (see example below).

;Create a copy of the item to forward
  $oForward1 = _OL_ItemForward($oOutlook, $aItems1[$j][0], Default, "")
  If @error <> 0 Then Exit MsgBox(16, "Item forward", "Error creating an item copy to forward. @error = " & @error & ", @extended = " & @extended)
  ;Add recipient
  _OL_ItemRecipientAdd($oOutlook, $oForward1, Default, $olTo, $Doc)
  If @error <> 0 Then Exit MsgBox(16, "Recipient add", "Error adding a recipient to the mail item. @error = " & @error & ", @extended = " & @extended)
  ;Send
  _OL_ItemSend($oOutlook, $oForward1)
  If @error <> 0 Then Exit MsgBox(16, "Item send", "Error sending the mail item. @error = " & @error & ", @extended = " & @extended)
  $oForward1.Display
Edited by mdcastle
Link to comment
Share on other sites

No. It's just to display the resulting item. You can savely delete this line.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

This is my first post but I have had good success using AutoIT for a number of tasks that I do and I appreciate having it available.

I decided to look at the OutLookEX UDF and was able to have success at using things like ItemFind, however I have run into an issue. One of the things I do is send a copy of the email that comes into my inbox and send it to folders in my PST folders. I then will have copies of my received email as in the OutLook mailbox on the server, the mail is archived after 14 days and I like to have a copy for later reference. I tried just using rules in OutLook to mark the copies in my PST folders as "read" status as I know those are copies and I don't care to see they are "Unread", but using the rules, it marks both copies on the server and in my PST folders as read, so that won't work for me.

I decided to use AutoIT / OutLookEX UDF to mark those items in the PST folders are "READ". I was able to do this on single level folders. However when I have folders with subfolders, on the ItemFind, I get an array error. This is what the error says:

Line 5102 (File "C:\Program Files\AutoIt3\Include\OutlookEx.au3"):

If UBound($avArrayTarget) > 1 Then $avArrayTarget[0][1]=UBound($ArrayTarget,2)

If UBound($avArrayTarget) > 1 Then ^ ERROR

Error: Array variable has incorrect numer of subscripts or subscript dimension range exceeded.

Addition information:

If I use the script on a folder with no subfolder it works fine. For example my ItemFind line looks like this:

$aItems = _OL_ItemFind($oOutlook, "Jim AlexanderTester", $olMail, "[unRead]=True", "", "", "EntryID","", 1) [where Tester has no subfolders] No error

If I have a subfolder such as SubTester2 below a folder called Tester2 and the ItemFind looks like this:

$aItems = _OL_ItemFind($oOutlook, "Jim AlexanderTester2", $olMail, "[unRead]=True", "", "", "EntryID","", 1) [with the subfolder not specified] then the error occurs.

If I have the same situation of Subfolder named SubTester2 below Tester2 and the ItemFind looks like this:

$aItems = _OL_ItemFind($oOutlook, "Jim AlexanderTester2SubTester2 "[unRead]=True", "", "", "EntryID","", 1) There is no error, but it only retrieves from SubTester2

It does not seem to matter if there are Unread items in any combination, if there is a Subfolder then it gets the error.

I have looked in the OutlookEx.au3 and found that it is in the section of _OL_ArrayConcatenate which concatenates 2D arrays. I thought that ItemFind would only retrun 2D arrays?

Any help would be appreciated.

Jim Alexander

Link to comment
Share on other sites

I assume you are using the latest version: 0.7.1.1?

Are there any unread items in the subfolders?

Will have to test tomorrow.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Water,

Thanks for the response. Yes UDF version is 0.7.1.1 - I went back into UltraEdit to check in the OutlookEX source for sure.

It doesn't seem to matter if there are unread items in the subfolder or not. I have tried the various combinations of unread in top folder only, unread in subfolder only, unread in both and the same error occurs.

Jim Alexander

I Should add .. I am using Outlook 2003 interacting with a MS Exchange server.

Edited by jimnbene
Link to comment
Share on other sites

Water,

I did a bit of inspecting and I think that I solved it .. or at least it is working for me. This is the code in the _OL_ArrayConcatenate internal function:

If BitAND($iOL_Flags, 2) <> 2 Then

$avArrayTarget[0][0] = $iNewSize - 1

If UBound($avArrayTarget) > 1 Then $avArrayTarget[0][1] = UBound($avArrayTarget, 2)

EndIf

I change the value in read to zero. I can't answer to why that works, but it is working fine for me now. I even added another level below, so there are two levels of subfolders and it works just fine.

I am sure you will look at the code and say, of course, and will realize the reason that works. If I would spend more time working on it and get my mind working on arrays again, I could figure out why, but it has been too many years since I had to work with arrays (maybe 20 years!).

Thanks for the great UDF, I appreciate your work and hope this helps out in some small way.

Jim Alexander

Sacramento, CA

Link to comment
Share on other sites

Thanks for digging into the issue.

It looks like the function works with 2D-arrays but has a problem when the second dimension only has one element.

I will do more testing and hope to come up with a solution quite soon.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Great, you found a bug!

Please change line

If UBound($avArrayTarget) > 1 Then $avArrayTarget[0][1] = UBound($avArrayTarget, 2)
to
If UBound($avArrayTarget, 0) > 1 Then $avArrayTarget[0][1] = UBound($avArrayTarget, 2)
and the problem should be solved.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Water,

I did change the line in OutlookEX as you suggested, adding the ',0' and changing the [0][0] back to [0][1], however it failed with the same error as before.

I left the ',0' in the UBound($avArrayTarget,0) but change the [0][1] back to [0][0] and it works again. I looked for how to post my code here, but I don't see the proper method, so I am going to make another post with just the code I am running to mark all items in my PST folder to be read. Perhaps that will shed some light on this.

Jim Alexander

Link to comment
Share on other sites

Here is the code to my "Outlook_mark_as_read.au3" file:

#include <Array.au3>

#include <OutlookEx.au3>

$sTitle = "Outlook Test Script"

$oOutlook = _OL_Open(True, "C:Program FilesAutoIt3_OL_Warnings.exe", 0, 0, "")

If @error Then Exit MsgBox(16, $sTitle, "Error returned by _OL_Open: " & @error & ", @extended: " & @extended)

Global $aItems = _OL_ItemFind($oOutlook, "Jim Alexander", $olMail, "[unRead]=True", "", "", "EntryID","", 1)

; No unread mail items

If $aItems [0][0] < 1 Then

Exit

Endif

Local $rows = UBound($aItems) - 1

For $i = 1 to $rows

_OL_ItemModify($oOutlook, $aItems[$i][0], Default, "UnRead=False")

Next

If @error Then Exit MsgBox(16, $sTitle, "Error returned by _OL_ItemFind: " & @error & ", @extended: " & @extended)

_OL_Close($oOutlook)

Exit

Link to comment
Share on other sites

Strange!

Could you please insert this line

ConsoleWrite(ubound($aArray,0) & "-" & ubound($aArray,1) & "-" & ubound($aArray,2) & @LF)
before line
If UBound($avArrayTarget, 0) > 1 Then $avArrayTarget[0][1] = UBound($avArrayTarget, 2)
in function _OL_ArrayConcatenate?

The result will be written to the console.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Your script doesn't look bad.

I would just change

$oOutlook = _OL_Open(True, "C:\Program Files\AutoIt3\_OL_Warnings.exe", 0, 0, "")
to
$oOutlook = _OL_Open(True, "C:\Program Files\AutoIt3\_OL_Warnings.exe")
because setting the two wait intervals to 0 will put heavy load on your CPU.

Forget what I've written in my last post. The line should read:

If UBound($avArrayTarget, 2) > 1 Then $avArrayTarget[0][1] = UBound($avArrayTarget, 2)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

water

I've got a question about _OL_ItemSave and incrementing an integer to enable saving of attachments with the same name - I'm not sure how to do it.

My current line of code is

_OL_ItemSave($oOutlook, $aResult[$i][0], Default, $SavePath & "", $olHTML, 2)

Where do I add in the underscore and the integer as per the help file?

Optional: Flags to set different processing options. Can be a combination of the following:

1: Save the item (default)

2: Save attachments. Will be saved into the same directory as the item itself.

Name is Filename of the item, underscore plus name of attachment plus (optional) unterscore plus integer so multiple att. with the same name

can be saved

Link to comment
Share on other sites

It's done by the function itself.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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