Jump to content
water

OutlookEX UDF: Example scripts

Recommended Posts

Version 1.3.4.0 of the UDF has been released.

  • General code enhancements
  • FIXED BUGS: _OL_PSTAccess: On error 4 Exit was used instead of Return. So this error ended your whole script.
  • CHANGED FUNCTIONS: _OL_PSTAccess: Now works with PST-files on network drives, though it is not recommended by Microsoft.
    Internal function __OL_PSTConvertUNC added to convert PST filepaths to UNC notation.

Please test before using in production!

For download please see my signature.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-06-17 - Version 1.5.0.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Version 1.3.5.0 of the UDF has been released.

Please test before using in production!

For download please see my signature.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-06-17 - Version 1.5.0.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Version 1.3.6.0 of the UDF has been released.

Please test before using in production!

For download please see my signature.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-06-17 - Version 1.5.0.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Version 1.4.0.0 of the UDF has been released.

Please test before using in production!

For download please see my signature.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-06-17 - Version 1.5.0.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Version 1.4.1.0 of the UDF has been released.

Please test before using in production!

For download please see my signature.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-06-17 - Version 1.5.0.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Version 1.5.0.0 of the UDF has been released.

Please test before using in production!

For download please see my signature.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-06-17 - Version 1.5.0.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites

Hello,

A total newbie to AutoIt , trying to learn the ropes. I a trying to build an automation of outlook (using this script) with USB light ThingM Blink(1) USB RGB LED BLINK1MK3, as well as Skype for Business with the same USB light. Given the current global situation I am also working from home and want to have a visual indicator for family and kids, for not disturbing me when I am in an active skype conference call. 

For Outlook 2016

  1. When a new mail arrives in my mail box the light would blink up with the color of choice. 
  2. Untill the mail is not read, the light remains blinking/solid, once the mail is read, it would turnoff or change colors.
  3. Also looking for a possibility to have a color blinking if I have unread mails in the mailbox, not necessarily arrived now or today but from past as well.

(Some queries below for outlook - as the OP post topic is about the same)

For Skype for Business

  1. Light up the light (possibly) in red, when an active call if going on, otherwise no indication.

(Dont have any clue how to make it happen - since there are no example scripts available)

Queries

1.For outlook there are two scripts in the unzipped scripts folder downloaded from this thread 

image.png.40fc589219bd903d6d2b2a740d515eb4.png

Can someone please inform which one is to be used to work with Outlook 2016 on Windows 10 x64

2. I tried using the following modified script by another user, to fit to my purpose , it is done by modifying "_OL_Example_NewMail_Event.au3" script

Line no. 3 and 7 are inserted to Run Blink USB light commands on various conditions. The below script runs fine and outputs the BlinkUSB light event. 

Func oOApp_NewMailEx($sOL_EntryId)
Local $oOL_Item = $oOApp.Session.GetItemFromID($sOL_EntryId, Default)
Run('"c:\Users\<user>\Downloads\Blink(1)\blink1-tool.exe" --rgb 255,153,0')
MsgBox(64, "OutlookEX UDF Example Script", "New mail has arrived!" & @CRLF & @CRLF & _
"From: " & $oOL_Item.SenderName & @CRLF & _
"Subject: " & $oOL_Item.Subject)
Run('"c:\Users\<user>\Downloads\Blink(1)\blink1-tool.exe" --off')

3. In the above script line no 3 and 7 are executing a windows command line tool with chosen arguments. The only difference I need to adjust over her is that instead of a CLI program I want to invoke a URL (an API running on local server) to do the same thing, using "CurL" . However when i trying using the above yntax to run CURL, it is not being triggered as desired.

I want to use a simple curl command ( curl http://localhost:8934/blink1/on ) in the above script, which I tried doing in the below manner 

Run('"curl http://localhost:8934/blink1/on"')

However the Curl command wasn't triggered. Is the above syntax correct, or is it my lack of knowledge to not use it properly. 

Can anyone please guide me how to insert Curl command in the above example script to be able to correctly trigger the URLs based on certain conditions.

Sorry and thanks for reading the long post.

Thanks for possible support and guidance.

 

 

 

 

Share this post


Link to post
Share on other sites

1. _OL_ExampleNewMailEX


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-06-17 - Version 1.5.0.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites
5 hours ago, water said:

1. _OL_ExampleNewMailEX

Well Thanks , I understand you are mentioning that this above script is to be used going forward,  but is it all the reply to my query above. 

Appreciate your guidance for rest of query in post.

Thanks.

Share this post


Link to post
Share on other sites

I would combine 1. and 2.
Example (Displays a tooltip when a new mail arrived in the upper left corner for about 10 seconds, unread mails do not cause any action at the moment):

#include <OutlookEX.au3>
AutoItSetOption("Mustdeclarevars", 1)
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 $bUnreadMails = False, $bNewMail = False, $sNewMailText, $aFolder, $oFolder, $iItemCount = 0
Global $iNewMailCount = 0, $iNewMailAlert = 10 * 1000 ; Display New Mail Alert for 10 seconds
Global $iSleepWait = 500 ; Milliseconds to sleep
Global $oOL = _OL_Open()
Global $oEvents = ObjEvent($oOL, "oOL_")
$aFolder = _OL_FolderAccess($oOL, "", $olFolderInbox)
$oFolder = $aFolder[1]

While 1
    ; Check for newly arrived mails
    If $bNewMail Then
        If $iNewMailCount = $iNewMailAlert Then ToolTip($sNewMailText, 0, 0, "", 0, $TIP_FORCEVISIBLE) ; Start blinking
        $iNewMailCount = $iNewMailCount - ($iSleepWait * 2) ; 2 times the Sleep value as _OL_Itemfind needs some processing time too
        If $iNewMailCount <= 0 Then
            ToolTip("") ; Stop blinking
            $bNewMail = False
        EndIf
    EndIf
    ; Check for unread Mails
    $iItemCount = _OL_ItemFind($oOL, $oFolder, $olMail, "[UnRead]=True", "", "", "", "", 4)
    If $iItemCount > 0 Then
        If $bUnreadMails = False Then ; First time unread mail was found
            ; Set color for unread mails here
            $bUnreadMails = True
        EndIf
    Else
        $bUnreadMails = False
        ; Switch "unread mails" color off
    EndIf
    Sleep($iSleepWait)
WEnd

; Outlook 2007 - NewMailEx event - http://msdn.microsoft.com/en-us/library/bb147646%28v=office.12%29.aspx
Func oOL_NewMailEx($sEntryIDs)
    $bNewMail = True
    $iNewMailCount = $iNewMailAlert
    $sNewMailText = "New Mail arrived:"
    Local $oItem, $aEntryIDs = StringSplit($sEntryIDs, ",", $STR_NOCOUNT)
    For $i = 0 To UBound($aEntryIDs) - 1
        $oItem = $oOL.Session.GetItemFromID($aEntryIDs[$i], Default)
        $sNewMailText = $sNewMailText & @CRLF & _
                "From:    " & $oItem.SenderName & @CRLF & _
                "Subject: " & $oItem.Subject
    Next
EndFunc   ;==>oOL_NewMailEx

Func _Exit()
    Exit
EndFunc   ;==>_Exit

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2020-06-17 - Version 1.5.0.1) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2020-06-27 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (NEW 2020-06-27 - Version 1.3.2.0) - Download
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 (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Share this post


Link to post
Share on other sites
Posted (edited)

Well thanks for the support, however I feel my query is not entirely clear. I am trying to integrate a physical USB notification light with the outlook mail script to check new mails. Probably in your example you have given the blinking notification option for on-screen notification slide-out in Windows itself.

If you see my original post, I need to know of a syntax after various conditions (if for example the new mail count is detected) to run an external CLI program to trigger a physical USB light .The USB light CLI command can be triggered by sending "CURL" command to specific local URL.

In the example quote above I cannot see how can i trigger external command line programs via "Run"  , the second query was "curl" was not triggered correctly with "Run", so what was the correct syntax to invoke a "Curl" command based on a condition met int he au.3 script.

Thanks.

Edited by AltereEgo

Share this post


Link to post
Share on other sites
22 hours ago, AltereEgo said:

Well thanks for the support, however I feel my query is not entirely clear. I am trying to integrate a physical USB notification light with the outlook mail script to check new mails. Probably in your example you have given the blinking notification option for on-screen notification slide-out in Windows itself.

If you see my original post, I need to know of a syntax after various conditions (if for example the new mail count is detected) to run an external CLI program to trigger a physical USB light .The USB light CLI command can be triggered by sending "CURL" command to specific local URL.

In the example quote above I cannot see how can i trigger external command line programs via "Run"  , the second query was "curl" was not triggered correctly with "Run", so what was the correct syntax to invoke a "Curl" command based on a condition met int he au.3 script.

Thanks.

So your issue is with the RUN syntax, is that correct? Does the preceding MsgBox trigger OK? Put some ConsoleWrite commands in there to step through what you are getting, as an aid to debugging.

Share this post


Link to post
Share on other sites
1 hour ago, Confuzzled said:

So your issue is with the RUN syntax, is that correct? Does the preceding MsgBox trigger OK? Put some ConsoleWrite commands in there to step through what you are getting, as an aid to debugging.

1. The MsgBox is triggered OK.

2. Absolutely, my qurey is can I run any windows CLI command with he "Run" command. As far a running an .exe or bat file it is running OK, however I tried to run a "curl" command with the Run prefix, which was not executed as expected.

3. So the question was is the "curl" also triggered as other Run commands or is there any other special function or syntax for it. 

4. Is there is a command debugger mode available in AutoIt, so I can try running Curl separately and post the output.

Thanks. 

 

Share this post


Link to post
Share on other sites

Running something with the Run command is like executing the command via the "Run" window (Press Windows key + R), as far as I can tell. I would suggest running curl like this to force a command prompt window to execute the command for you:

; Write the curl command out completely here
Local $sYourCurlCommand = "curl www.google.com"
; Run the Curl command throught the command prompt. See the helpfile for @ComSpec and " /c "
Local $iPID = Run(@ComSpec & " /c " & $sYourCurlCommand, "", @SW_MAXIMIZE, $STDOUT_CHILD)
; If there was an error when running the command then Exit with a message box
If @error then Exit MsgBox(0, "Invalid Syntax", "Your curl command failed to execute. Check the syntax of your command.")
; Wait for the process to close
ProcessWaitClose($iPID)
; Now you can read what curl prints to the command prompt window
ConsoleWrite(StdOutRead($iPID) & @CRLF)

Note: you may need to specify the complete path to the curl executable if it isn't in your path

And, no, AutoIt doesn't really come with a command debugger... you check the @error macro to look for errors and you test things out via test scripts and the command prompt


All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...