Jump to content

OutlookEX UDF - Help & Support (IV)


Recommended Posts

"Outlook Data Files (.ost) are used when you have an Exchange account and want to work offline or use the default Cached Exchange Mode. This type of data file is also used for accounts that you set up with the Outlook Connector for Outlook.com (formerly Hotmail). Outlook Data Files (.ost) are always copies of items that are saved on a mail server and don’t need to be backed up like Outlook Data Files (.pst)."

So _OL_Open connects to a local data file (OST, PST) or a remote server (Exchange ...) depending on the type of store.

As soon as you connect your computer to a network Outlook tries to synchronize offline stores with the remote server.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites
  • Replies 516
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Fixed in version 1.3.3.1 of the UDF I uploaded today

Version 1.7.0.0 of the UDF has been released. Now you get a help file that looks like the AutoIt help. Please test before using in production! For download please see my signature.

I know I'm not Bill Murray, so I'm not a god  

Posted Images

@water 

>> So _OL_Open connects to a local data file (OST, PST) or a remote server (Exchange ...) depending on the type of store.

OK.  I have several stores in my Outlook.  How do I determine the "type" of each store?  And how do I know which types connect to the local data file, and which types make a remote connection?

 

Link to post
Share on other sites

OK, why don't you try to show some effort yourself?
This kind of information can easily be found using Google or by having a look at the functions of the OutlookEX UDF. Hint: _OL_StoreGet ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

@water OK I can do that.  I found this documentation page about store objects.  It unfortunately appears to have some outdated information about IMAP accounts and OST files.   It indicates that PST files are used for IMAP email accounts in Outlook.  The documentation page you linked earlier also contains the same information.  But that contradicts what it says on this other MS documentation page about PST and OST files.  This page indicates that OST files--not PST files--are used for IMAP email accounts, which is also the behavior with my Outlook--all of my IMAP files use OST files.

So in light of that, with these IMAP stores, should I expect _OL_Open to connect to the local OST data file or the remote server?  This is the crux of my issue, and what I'm still very unclear on.  Earlier you mentioned,

>> _OL_Open just uses the AutoIt functions ObjGet and ObJCreate to connect to Outlook or create a new instance. 

Perhaps I should post in the general AutoIt forums asking exactly how ObjGet and/or ObjCreate connect to these stores?

>> This kind of information can easily be found using Google or by having a look at the functions of the OutlookEX UDF. Hint: _OL_StoreGet

I am admittedly a novice when it comes to AutoIt, so reading through an advanced function written by someone else would be difficult.  That's why I'm asking my question in this forum.

 

Link to post
Share on other sites

If IMAP accounts are represented by a PST or OST file depends on the installed version of Outlook. _OL_Open will always connect to the local representation of such accounts.
The connection to the remote server is being done by Outlook when a network connection is available. Then Outlook synchronizes the servers content with the local OST file.

The Outlook UDF comes with a OutlookEx.htm help file. Open this help file, search for "Store" and you will find _OL_StoreGet. The description will tell you which information to expect:

Quote

Success - two-dimensional one based array with the following information:
    0 - display name of the Store object
    1 - Constant in the OlExchangeStoreType enumeration that indicates the type of an Exchange store
    2 - Full file path for a Personal Folders File (.pst) or an Offline Folder File (.ost) store
    3 - True if the store is a cached Exchange store
    4 - True if the store is a store for an Outlook data file (Personal Folders File (.pst) or Offline Folder File (.ost))
    5 - True if Instant Search is enabled and operational
    6 - True if the Store is open
    7 - String identifying the Store (StoreID)
    8 - True if the OOF (Out Of Office) is set for this store
    9 - Warning Threshold represented in kilobytes (in KB)
    10 - The limit at which a user can no longer send messages represented in kilobytes (KB)
    11 - The limit where receiving mail is prohibited (also the maximum size of the mailbox) in kilobytes (KB)
    12 - Contains the sum of the sizes of all properties in the mailbox or mailbox root in kilobytes (KB)
    13 - The free space in the mailbox represented in kilobytes (KB)
    14 - The maximum size for a message that a user can send represented in kilobytes (KB)

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

OK that is helpful, thanks.  And I can have a further look through the documentation files for each UDF function.

But finally, maybe I should address the overarching issue.  Namely, you said earlier ,

>> You should expect _OL_Open to connect to ALL defined stores of a profile may they be located on an Exchange server, in a local PST-file or on a Google mail server.

In my case, I want to simply use the Outlook UDF to create a new task, which will be stored in one single PST file on my computer.  This particular PST file is linked to no email accounts--it contains only my tasks, reminders, and calendar.  So you are saying that in order to create this task with the Outlook UDF, it needs to make a connection to every single email account in my Outlook profile?  If so, that seems completely unnecessary from my admittedly novice point of view.  I guess that's the way it has to be.  But wouldn't you agree that at best it's a tad inefficient, and at worst, it completely prohibits the use of the Outlook UDF?  In my case, the latter is what seems to be occurring.  If my Outlook profile has 10 stores, and I want to use the UDF to edit one of those stores, why does the UDF need to connect to the remaining 9 stores?  

Is it possible to instruct _OL_Open to bypass certain stores when making its connections?  That sounds like a more efficient course of action, and one that would alleviate the issue I'm experiencing.  Or, if Outlook is already open and has connected to all its stores, perhaps _OL_Open can simply use those existing connections, rather than having to make new connection?  But now I'm admittedly just thinking off the top of my head.  Or maybe as a workaround I could create a second Outlook profile--a profile containing only the PST with my tasks/calendars.  Then _OL_Open wouldn't have to connect to all my other stores.  But then I would have two profiles, and I would need to have Outlook open on my computer with both profiles at the same time--is that even possible?

Edited by cag8f
Link to post
Share on other sites

The issue you describe is not related to the Outlook UDF but to Outlook itself.Outlook opens all stores defined in a profile.
The way to solve this problem is to create a new profile with only a single store and then use this profile with _OL_Open (check the help file how to do).
The profile needs to be created manually as MS does not provide an interface to do this programmatically.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

How to create a new profile is described here (though I have never done it myself): https://support.combell.com/en/how-do-i-create-a-new-mail-profile-in-outlook/200

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

@water 

>> The issue you describe is not related to the Outlook UDF but to Outlook itself.Outlook opens all stores defined in a profile.

Right O.

>> The way to solve this problem is to create a new profile with only a single store and then use this profile with _OL_Open (check the help file how to do).
>> How to create a new profile is described here (though I have never done it myself): https://support.combell.com/en/how-do-i-create-a-new-mail-profile-in-outlook/200

Right.  I'm aware using a profile with only one store can alleviate my issue, and I know how to create a new profile.  But doing so may cause a new, prohibitive issue.  Namely, once I create that new profile I will now have two different profiles:

  • Profile 1:  A single PST containing only my tasks/reminders/calendar items.
  • Profile 2:  10 different email accounts--a mixture of POP (PST) and IMAP (OST).

Whenever I open Outlook, I will need Outlook to load both of these profiles. Is it possible to load two different profiles in Outlook?  Or open two different instances of Outlook, each with a different profile?  Intuition, experience, and a quick search indicate that the answer is 'no' (post 1, post 2).  So creating a new profile isn't a viable solution in my case.

Just to be 100% sure before I pursue an alternative:  `_OL_Open` will connect to every Outlook store even if Outlook is already open, and has already connected to those stores.  Is that accurate?

Edited by cag8f
Link to post
Share on other sites

I suggest to have two profiles:

  • The default profile you use right now should hold ALL stores including the PST for your tasks/reminders/calendar items
  • The second profile should only hold the PST for your tasks/reminders/calendar items

So when performance is an issue open Outlook with profile two, else use the default profile.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

@water Thanks for that suggestion.  It could be viable in other situations, but I don't think it will be in my case.  In my case, I am looking to create a keyboard shortcut which will simply create a new Outlook task and add some text in the description.  I sometimes do this many times a day, which is why i'd like a keyboard shortcut to do it quickly.  If I have to:

  • close Outlook
  • re-open Outlook with profile 2
  • execute the keyboard shortcut
  • close Outlook
  • re-open Outlook with profile 1

then you can see that it defeats the purpose of the keyboard shortcut.

It looks like I'll have to use a different approach.  Although I initially tried doing this with simple `Send()` commands, but encountered a different error--see post here, It was in that post that I was referred to the Outlook UDF.  

I appreciate your help and patience.  In the least, I learned some things about the Outlook UDF.  I may use it to automate the PST backups that I manually carry out every month.

Link to post
Share on other sites

Another idea would be to have a (slightly) modified version of _OL_Open.
Now _OL_Open tries to connect to an already running instance of Outlook. If there is none, a new instances is started.
The modification would drop the check for a running instance and always start a new one (which could be started with profile #2).
Don't know if Outlook supports this but it would be worth a try.

There is only one drawback. If the running Outlook instances opens your task PST you can't open it in a second instance.

 

Edit: Just noticed that this is post #24000 on this forum :cheer:

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Or you could split your task into two pieces.

  1. The script just waits for the hotkey and writes the task to a file in a specific folder with a unique name (timestamp)
  2. Another script periodically checks the folder for new tasks and creates them in your PST file. As this task is not time critical it does not matter now long it takes. Whne the task has been created the file is deleted.
    This script runs in a loop so _OL_Open is only called once at startup time.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

@water Well to be clear,  Earlier I said I am looking to create a keyboard shortcut which will create a new Outlook task and add some text in the description.  That is not untrue.  But after the AutoIt script carries that out, I will need the task to remain open and active so i can then add more text to it (and make some modifications to reminder date, category, etc).  Does this new information change your split-task-into-two-pieces method?  I didn't quite understand it, but I noticed you mentioned that *somethign* was not time critical.

Another idea would be to have a (slightly) modified version of _OL_Open.
Now _OL_Open tries to connect to an already running instance of Outlook. If there is none, a new instances is started.
The modification would drop the check for a running instance and always start a new one (which could be started with profile #2).
Don't know if Outlook supports this but it would be worth a try.

So are you saying I would be the one to modify `_OL_Open`?

> Edit: Just noticed that this is post #24000 on this forum

Congrats!

Link to post
Share on other sites

If you want to edit the task immediately after it has been created then my "solution" won't help.

The _OL_Open approach doesn't help either as Outlook won't create a second instance.

So, right now, I'm out of ideas :(

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites
On 3/21/2019 at 4:59 PM, water said:

@Juvigy Never had to cope with Group Policies.
How does it affect you? Is this limited to VBA macros in Outlook or do you encounter problems with Autoit scripts accessing Outlook as well?

It stops my outlook macros that call autoit scripts.

Link to post
Share on other sites

In this case you need to ask your admin :(

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to post
Share on other sites

Hi,

 

I'm not sure if I'm at the correct place here but I should give it a try.

I think there's an error when using default values for fetching calendar entries. This works:

$oi = _OL_ItemFind($oo, $of[1], $olAppointment, "[Start]>'01/04/2019 00:00'", "", "", "", "",4)

$oi = _OL_ItemFind($oo, $of[1], $olAppointment, "[Start]>'01/04/2019 00:00'", "", "", "", "",4)

I'm getting a value with the correct count.

This throws an error:

$oi = _OL_ItemFind($oo, $of[1], $olAppointment, "[Start]>'01/04/2019 00:00'")

"C:\...\autoit\Include\OutlookEX.au3" (2947) : ==> The requested action with this object has failed.:
$aItems[$iCounter][$iIndex - 1] = $oItem.ItemProperties.Item($aReturnProperties[$iIndex]).value
$aItems[$iCounter][$iIndex - 1] = $oItem.ItemProperties.Item($aReturnProperties[$iIndex])^ ERROR

But if I specify the ReturnProperties, it works again:

$oi = _OL_ItemFind($oo, $of[1], $olAppointment, "[Start]>'01/04/2019 00:00'","","","EntryID,Subject")

 

Link to post
Share on other sites

Which version of Outlook do you run?
Which version of AutoIt do you rin?
Which version of the OutlookEX UDF do you use?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

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

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Cyborg5000
      Can some one please point me why i keep getting the error while the script is in loop:-
      "C:\Program Files (x86)\AutoIt3\Include\OutlookEX.au3" (2443) : ==> Subscript used on non-accessible variable.:
      If Not (IsNumber($iAttachment)) Or $iAttachment < 1 Or $iAttachment > $aAttachments[0][0] Then Return SetError(8, $aAttachments[0][0], 0)
      If Not (IsNumber($iAttachment)) Or $iAttachment < 1 Or $iAttachment > $aAttachments^ ERROR
      My code as below though copied and modified as per need, to get attachments, and other details.
      #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <IE.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiStatusBar.au3> #include <StringConstants.au3> #include <FileConstants.au3> #include <Array.au3> #include <String.au3> #include <UIAWrappers.au3> #include <GuiEdit.au3> #include <Clipboard.au3> #include <WinAPI.au3> #include <ColorConstants.au3> #include <FontConstants.au3> #include <ProgressConstants.au3> #include <Restart.au3> #include <_IEquerySelectorAll.au3> #include <GuiRichEdit.au3> #include <hiddenDesktopInteract.au3> #include <Date.au3> #include <CUIAutomation2.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <OutlookEX.au3> #include <Misc.au3> #include <MsgBoxConstants.au3> ;Global $oErrorHandler = ObjEvent("Autoit.Error", "ComErrorHandler") FileDelete("D:\attachment\*.*") FileDelete("D:\Email-Details\*.*") FileDelete("D:\Script-temp\*.*") FileDelete("D:\Downloaded-Cert\*.*") FileDelete("D:\LOG\*.*") RunWait("taskkill /F /IM iexplore.exe /T", "", @SW_HIDE) ;Global $Errorcomments ;If Not IsDeclared($Errorcomments) Then Global $Errorcomments ; ***************************************************************************** ; Example Script ; Handle Outlook NewmailEX event when a new mail arrives. ; This script loops until Shift-Alt-E is pressed to exit. ; ***************************************************************************** HotKeySet("+!e", "_Exit") ;Shift-Alt-E to Exit the script ;MsgBox(64, "OutlookEX UDF Example Script", "Hotkey to exit the script: 'Shift-Alt-E'!") Global $oOApp = ObjCreate("Outlook.Application") Global $test = ObjEvent($oOApp, "oOApp_") While 1     Sleep(400) WEnd FileDelete("D:\attachment\*.*") FileDelete("D:\Email-Details\*.*") FileDelete("D:\Script-temp\*.*") FileDelete("D:\Downloaded-Cert\*.*") FileDelete("D:\LOG\*.*") RunWait("taskkill /F /IM iexplore.exe /T", "", @SW_HIDE) ; Outlook 2007 - NewMailEx event - http://msdn.microsoft.com/en-us/library/bb147646%28v=office.12%29.aspx Func oOApp_NewMailEx($sOL_EntryId)     FileDelete("D:\attachment\*.*")     FileDelete("D:\Email-Details\*.*")     FileDelete("D:\Script-temp\*.*")     FileDelete("D:\Downloaded-Cert\*.*")     FileDelete("D:\LOG\*.*")     RunWait("taskkill /F /IM iexplore.exe /T", "", @SW_HIDE)     Sleep(1000)     Local $oOL_Item = $oOApp.Session.GetItemFromID($sOL_EntryId, Default)     Sleep(1000)     _OL_ItemAttachmentSave($oOApp, $oOL_Item, Default, 1, "D:\attachment\")     Sleep(1000)     ;MsgBox(64, "OutlookEX UDF Example Script", "New mail has arrived!" & @CRLF & @CRLF & _     ;"From:    " & $oOL_Item.SenderName & @CRLF & _     ;"Subject: " & $oOL_Item.Subject)     Local $oOL_Item1 = $oOApp.Session.GetItemFromID($sOL_EntryId, Default)     Sleep(1000)     Local $oOL_Sender = $oOL_Item1.Sender     If $oOL_Sender.AddressEntryUserType = $olExchangeUserAddressEntry Or $oOL_Sender.AddressEntryUserType = $olExchangeRemoteUserAddressEntry Then         Local $oExchangeUser = $oOL_Sender.GetExchangeUser     Else         Sleep(2000)     EndIf     Sleep(1000)     Local $sendername = ("D:\Email-Details\sendername.txt")     Local $Subject = ("D:\Email-Details\subject.txt")     ;=================================Subjectfile file write ===========================================     Local $Subject1 = FileOpen($Subject, $FO_APPEND)     If $Subject1 = -1 Then         MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the Subject file.")         Return False     EndIf     ; Write data to the file using the handle returned by FileOpen.     FileWrite($Subject1, $oOL_Item1.Subject)     ; Close the handle returned by FileOpen.     FileClose($Subject1)     Sleep(1000) ;=================================End sendername file write ===========================================     $Filerunpath = ("C:\Users\certauto\Desktop\Test.Exe")     Local $iPID = Run($Filerunpath)     ProcessWaitClose($iPID)     Sleep(1000)     _OL_ItemModify($oOApp, $oOL_Item, Default, "Unread=False")     ;$openemail = WinActivate ( "[CLASS:NetUIHWND; INSTANCE:1]", "" )     ;ControlClick($openemail, "", "NUIDialog")     ;$oOApp.Session.Logoff     Sleep(1000)     ;====================Mark email as read===========================================     ;_OL_ItemModify($oOL_Item,$oOApp.Session.GetItemFromID($sOL_EntryId, Default, "Unread=False")     Sleep(1000) EndFunc   ;==>oOApp_NewMailEx Func _Exit()     Exit EndFunc   ;==>_Exit
    • By Skysnake
      This assumes implementation of the OutlookEX UDF.
      I have PSTs which are becoming unmanageable 
      The idea is to make a simple GUI (Listview) which can combine non-Outlook data and include emails based on criteria.  Manage them in the GUI (delete / reply etc) and update to Outlook.
      So the issue would be to manage the items in the GUI while using the PST as a database.
      Ideas on how to do this? What would the key be?
    • By Reizvoller
      Howdy!
      I've been reading through the OutLookEX documentation and examples for the past two days ( VERY well documented, very clear! ) 
      https://www.autoitscript.com/wiki/OutlookEX_UDF_-_General
       
      But I've had trouble locating information on specifying what user to use. My outlook is linked to two email accounts and I can only manipulate the main account's stuff. A simple script I've been playing with is this 
      ; Include Functions #include <OutlookEX.au3> ; Connect to Outlook Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "Connect to Outlook", "Error connecting to Outlook. @error = " & @error & ", @extended = " & @extended) ;List the folders Global $aResult = _OL_FolderTree($oOutlook, "*") If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderTree Example Script", "Error accessing root folder. @error = " & @error) _ArrayDisplay($aResult, "OutlookEX UDF: _OL_FolderTree Example Script - All folders") It works like a charm but it only returns my main account's folders. 
      I really hope I didn't overlook a wiki page or help file... 
      Any assistance would be greatly appreciated!
      -Reiz
    • By galan2015
      Is there any solution on receiving e-mails? I would like to create a script so that I will not have to log in through the browser.
×
×
  • Create New...