Jump to content

Recommended Posts

Posted

The PRF file is a simple text file. The format can be found here.

Then start Outlook with parameter /importprf as described in the linked document.

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

 

Posted

water

I'm trying to use _OL_ItemAttachmentAdd to add a file with a comma " , " in the filename. When I try this I get @error = 4, @extended = 0. Is this a bug or are filenames with commas in not supported?

Posted

Version 0.7.1.1 of the UDF doesn't support files with commas. Version 0.8.0.0 allows to specify a separator.

If needed I can check the changed function and post _OL_ItemAttachmentAdd.

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

 

Posted

Here you go. Replace the function in the UDF with this one. Then you can pass a delimiter character.

; #FUNCTION# ====================================================================================================================
; Name ..........: _OL_ItemAttachmentAdd
; Description ...: Adds one or more attachments to an item.
; Syntax.........: _OL_ItemAttachmentAdd($oOL, $vOL_Item, $sOL_StoreID, $vOL_P1 = ""[, $vOL_P2 = ""[, $vOL_P3 = ""[, $vOL_P4 = ""[, $vOL_P5 = ""[, $vOL_P6 = ""[, $vOL_P7 = ""[, $vOL_P8 = ""[, $vOL_P9 = ""[, $vOL_P10 = ""[, $sOL_Delimiter = ","]]]]]]]]]])
; Parameters ....: $oOL        - Outlook object returned by a preceding call to _OL_Open()
;                 $vOL_Item   - EntryID or object of the item
;                 $sOL_StoreID   - StoreID where the EntryID is stored. Use the keyword "Default" to use the users mailbox
;                 $vOL_P1       - The source of the attachment. This can be a file (represented by the full file system path (drive letter or UNC path) with a file name) or an
;                 +Outlook item (EntryId or object) that constitutes the attachment
;                 +or a zero based one-dimensional array with unlimited number of attachments.
;                 |Every attachment parameter can consist of up to 4 sub-parameters separated by commas or parameter $sOL_Delimiter:
;                 | 1 - Source: The source of the attachment as described above
;                 | 2 - (Optional) Type: The type of the attachment. Can be one of the OlAttachmentType constants (default = $olByValue)
;                 | 3 - (Optional) Position: For RTF format. Position where the attachment should be placed within the body text (default = Beginning of the item)
;                 | 4 - (Optional) DisplayName: For RTF format and Type = $olByValue. Name is displayed in an Inspector object or when viewing the properties of the attachment
;                 $vOL_P2       - Optional: Same as $vOL_P1 but no array is allowed
;                 $vOL_P3       - Optional: Same as $vOL_P2
;                 $vOL_P4       - Optional: Same as $vOL_P2
;                 $vOL_P5       - Optional: Same as $vOL_P2
;                 $vOL_P6       - Optional: Same as $vOL_P2
;                 $vOL_P7       - Optional: Same as $vOL_P2
;                 $vOL_P8       - Optional: Same as $vOL_P2
;                 $vOL_P9       - Optional: Same as $vOL_P2
;                 $vOL_P10     - Optional: Same as $vOL_P2
;                 $sOL_Delimiter - Optional: Delimiter to separate the sub-parameters of the attachment parameters $vOL_P1 - $vOL_P10 (default = ",")
; Return values .: Success - Item object
;                 Failure - Returns 0 and sets @error:
;                 |1 - No Outlook item specified
;                 |2 - Item could not be found. EntryID might be wrong
;                 |3 - Error adding attachment to the item list. @extended = number of the invalid attachment (zero based)
;                 |4 - Attachment could not be found. @extended = number of the invalid attachment (zero based)
; Author ........: water
; Modified.......:
; Remarks .......: $vOL_P2 to $vOL_P10 will be ignored if $vOL_P1 is an array of attachments.
;                 For more details about sub-parameters 2-4 please check MSDN for the Attachments.Add method
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _OL_ItemAttachmentAdd($oOL, $vOL_Item, $sOL_StoreID, $vOL_P1, $vOL_P2 = "", $vOL_P3 = "", $vOL_P4 = "", $vOL_P5 = "", $vOL_P6 = "", $vOL_P7 = "", $vOL_P8 = "", $vOL_P9 = "", $vOL_P10 = "", $sOL_Delimiter = ",")

    Local $aOL_Attachments[10]
    If Not IsObj($vOL_Item) Then
        If StringStripWS($vOL_Item, 3) = "" Then Return SetError(1, 0, 0)
        $vOL_Item = $oOL.Session.GetItemFromID($vOL_Item, $sOL_StoreID)
        If @error Then Return SetError(2, @error, 0)
    EndIf
    ; Move attachments into an array
    If Not IsArray($vOL_P1) Then
        $aOL_Attachments[0] = $vOL_P1
        $aOL_Attachments[1] = $vOL_P2
        $aOL_Attachments[2] = $vOL_P3
        $aOL_Attachments[3] = $vOL_P4
        $aOL_Attachments[4] = $vOL_P5
        $aOL_Attachments[5] = $vOL_P6
        $aOL_Attachments[6] = $vOL_P7
        $aOL_Attachments[7] = $vOL_P8
        $aOL_Attachments[8] = $vOL_P9
        $aOL_Attachments[9] = $vOL_P10
    Else
        $aOL_Attachments = $vOL_P1
    EndIf
    ; add attachments to the item
    For $iOL_Index = 0 To UBound($aOL_Attachments) - 1
        Local $aOL_Temp = StringSplit($aOL_Attachments[$iOL_Index], $sOL_Delimiter)
        ReDim $aOL_Temp[5] ; Make sure the array has 4 elements (element 2-4 might be empty)
        If StringMid($aOL_Temp[1], 2, 1) = ":" Or StringLeft($aOL_Temp[1], 2) = "" Then ; Attachment specified as file (drive letter or UNC path)
            If Not FileExists($aOL_Temp[1]) Then Return SetError(4, $iOL_Index, 0)
        ElseIf Not IsObj($aOL_Temp[1]) Then ; Attachment specified as EntryID
            If StringStripWS($aOL_Attachments[$iOL_Index], 3) = "" Then ContinueLoop
            $aOL_Temp[1] = $oOL.Session.GetItemFromID($aOL_Temp[1], $sOL_StoreID)
            If @error Then Return SetError(4, $iOL_Index, 0)
        EndIf
        If $aOL_Temp[2] = "" Then $aOL_Temp[2] = $olByValue ; The attachment is a copy of the original file
        If $aOL_Temp[3] = "" Then $aOL_Temp[3] = 1 ; The attachment should be placed at the beginning of the message body
        $vOL_Item.Attachments.Add($aOL_Temp[1], $aOL_Temp[2], $aOL_Temp[3], $aOL_Temp[4])
        If @error Then Return SetError(3, $iOL_Index, 0)
    Next
    $vOL_Item.Close(0)
    Return $vOL_Item

EndFunc   ;==>_OL_ItemAttachmentAdd

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

 

Posted

Any word on the error below? I am getting it with the latest version...and only with one address I'm trying to use.

thanx

Error 4004 is error 4 returned by _OL_ItemRecipientAdd. It means: Recipient name could not be resolved. @extended = number of the invalid recipient (zero based)

I don't understand (at the moment) why the name can be resolved when manually added but can't when added using the UDF.

More investigation is needed ....

Posted

If you manually create a mail in Outlook, enter this special address as a recipient and then click on "Resolve" (or whatever the button to check the recipients is named in english) does it resolve the address or does Outlook show you a selection dialog where you can pick a recipient?

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

 

Posted (edited)

it wouldnt resolve...

anyhow, I figured out how to make it work. I am using explicit email addresses (not names or some alias) to send the emails...eg blah@yahoo.com

I edited the udf _OL_ItemRecipientAdd function

I changed:

If @error Or Not IsObj($oOL_Recipient) Then Return SetError(4, $iOL_Index, 0)

$oOL_Recipient.Resolve

If @error Or Not $oOL_Recipient.Resolved Then Return SetError(4, $iOL_Index, 0)

to

If @error Or Not IsObj($oOL_Recipient) Then Return SetError(4, $iOL_Index, 0)

$oOL_Recipient.Resolve

If @error Or Not $oOL_Recipient.Resolved Then

if stringregexp("","(?;)(?:\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\B)",0) = 0 Then

Return SetError(4, $iOL_Index, 0)

endif

endif

so now if the resolve fails, it looks at the address and verifies its an email address..if it is, then it just goes on about its merry way...and works perfectly.

:)

In a totally unrelated note..but just so the workaround is here I also had to change the _OL_Warnings.au3 file. It wouldnt click as it was..but a small change and it works now.

If ControlCommand($sWindowTitle, $sWindowText, "Button4", "IsEnabled") Then

ControlFocus($sWindowTitle, $sWindowText, "[CLASS:Button; INSTANCE:4]")

Send("{SPACE}")

sleep(200)

ControlClick($sWindowTitle, $sWindowText, "Button4")

ToolTip("")

ExitLoop

EndIf

one more..I kept getting an error: "The connection to the Microsoft Exchange Server is unavailable. Outlook must be online or connected to complete this action."

this had nothing to do with the script...search the web for the above error and go to the microsoft link which will change the registry to fix it.

so there are my workarounds to what wouldnt work for me. I have a unique setup going thru encryption VPN and using OL 2003.

btw...thank you for the very kewl and EXTREMELY useful script. Well done and nicely executed. Small edits to the script is now making it possible for me to automate the checking of a server error log and sending emails to responsible parties...

I can even send myself a text message on the critical errors now with outlook so I'm notified anywhere, anytime!!!!

hat's off to you

BT

Edited by brycetech
Posted

If you pass an email address to _OL_ItemRecipientAdd it should resolve fine (if unique). If it doesn't resolve (because there are multiple address entries with the same mail address, you just ignore the error because the mail address is valid anyway.

Excellent!

I will include this with the next version of the UDF.

I will have a look at the OL_Warnings issue as soon as I'm in my Office again.

I'm glad you like the UDF and that it is useful to you ;)

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

 

Posted

it wouldnt resolve...

anyhow, I figured out how to make it work. I am using explicit email addresses (not names or some alias) to send the emails...eg blah@yahoo.com

I edited the udf _OL_ItemRecipientAdd function

I changed:

If @error Or Not IsObj($oOL_Recipient) Then Return SetError(4, $iOL_Index, 0)

$oOL_Recipient.Resolve

If @error Or Not $oOL_Recipient.Resolved Then Return SetError(4, $iOL_Index, 0)

to

If @error Or Not IsObj($oOL_Recipient) Then Return SetError(4, $iOL_Index, 0)

$oOL_Recipient.Resolve

If @error Or Not $oOL_Recipient.Resolved Then

if stringregexp("","(? :)(?:\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\ ;)",0) = 0 Then

Return SetError(4, $iOL_Index, 0)

endif

endif

so now if the resolve fails, it looks at the address and verifies its an email address..if it is, then it just goes on about its merry way...and works perfectly.

I think that's a problem related to Outlook 2003. I tested with Outlook 2010 and an SMTP address was always successfully resolved.

I have added a flag to function _OL_ItemRecipientAdd. Could you please test by setting the flag to True (default) and False and if it works I will add it to the next release.

; #FUNCTION# ====================================================================================================================
; Name ..........: _OL_ItemRecipientAdd
; Description ...: Adds one or multiple recipients to an item.
; Syntax.........: _OL_ItemRecipientAdd($oOL, $vOL_Item, $sOL_StoreID, $iOL_Type, $vOL_P1 = ""[, $vOL_P2 = ""[, $vOL_P3 = ""[, $vOL_P4 = ""[, $vOL_P5 = ""[, $vOL_P6 = ""[, $vOL_P7 = ""[, $vOL_P8 = ""[, $vOL_P9 = ""[, $vOL_P10 = ""[, $bOL_AllowUnresolved = True]]]]]]]]]])
; Parameters ....: $oOL              - Outlook object returned by a preceding call to _OL_Open()
;                 $vOL_Item         - EntryID or object of the item item
;                 $sOL_StoreID       - StoreID where the EntryID is stored. Use the keyword "Default" to use the users mailbox
;                 $iOL_Type         - Integer representing the type of recipient. For details see Remarks
;                 $vOL_P1             - Recipient to add to the item. Either a recipient object or the recipients name to be resolved
;                 +or a zero based one-dimensional array with unlimited number of recipients
;                 $vOL_P2             - Optional: recipient to add to the item. Either a recipient object or the recipients name to be resolved
;                 $vOL_P3             - Optional: Same as $vOL_P2
;                 $vOL_P4             - Optional: Same as $vOL_P2
;                 $vOL_P5             - Optional: Same as $vOL_P2
;                 $vOL_P6             - Optional: Same as $vOL_P2
;                 $vOL_P7             - Optional: Same as $vOL_P2
;                 $vOL_P8             - Optional: Same as $vOL_P2
;                 $vOL_P9             - Optional: Same as $vOL_P2
;                 $vOL_P10           - Optional: Same as $vOL_P2
;                 $bOL_AllowUnresolved - Optional: True doesn't return an error even when unresolvable SMTP addresses have been found (default = True)
; Return values .: Success - Item object
;                 Failure - Returns 0 and sets @error:
;                 |1 - No item specified
;                 |2 - Item could not be found. EntryID might be wrong
;                 |5 - $iOL_Type is missing or not a number
;                 |3nn - Error adding recipient to the item. @extended = error code returned by the Recipients.Add method, nn = number of the invalid recipient (zero based)
;                 |4nn - Recipient name could not be resolved. @extended = error code returned by the Resolve method, nn = number of the invalid recipient (zero based)
;                 |6nn - Recipient object could not be created. @extended = error code returned by the CreateRecipient method, nn = number of the invalid recipient (zero based)
; Author ........: water
; Modified.......:
; Remarks .......: $vOL_P2 to $vOL_P10 will be ignored if $vOL_P1 is an array of recipients
;                 +
;                 Valid $iOL_Type parameters:
;                 MailItem recipient: one of the following OlMailRecipientType constants: olBCC, olCC, olOriginator, or olTo
;                 MeetingItem recipient: one of the following OlMeetingRecipientType constants: olOptional, olOrganizer, olRequired, or olResource
;                 TaskItem recipient: one of the following OlTaskRecipientType constants: olFinalStatus, or olUpdate
; Related .......:
; Link ..........:
; Example .......: Yes
; ===============================================================================================================================
Func _OL_ItemRecipientAdd($oOL, $vOL_Item, $sOL_StoreID, $iOL_Type, $vOL_P1, $vOL_P2 = "", $vOL_P3 = "", $vOL_P4 = "", $vOL_P5 = "", $vOL_P6 = "", $vOL_P7 = "", $vOL_P8 = "", $vOL_P9 = "", $vOL_P10 = "", $bOL_AllowUnresolved = True)

    Local $oOL_Recipient, $aOL_Recipients[10], $oOL_TempRecipient
    If Not IsNumber($iOL_Type) Then Return SetError(5, 0, 0)
    If Not IsObj($vOL_Item) Then
        If StringStripWS($vOL_Item, 3) = "" Then Return SetError(1, 0, 0)
        $vOL_Item = $oOL.Session.GetItemFromID($vOL_Item, $sOL_StoreID)
        If @error Then Return SetError(2, @error, 0)
    EndIf
    ; Move members into an array
    If Not IsArray($vOL_P1) Then
        $aOL_Recipients[0] = $vOL_P1
        $aOL_Recipients[1] = $vOL_P2
        $aOL_Recipients[2] = $vOL_P3
        $aOL_Recipients[3] = $vOL_P4
        $aOL_Recipients[4] = $vOL_P5
        $aOL_Recipients[5] = $vOL_P6
        $aOL_Recipients[6] = $vOL_P7
        $aOL_Recipients[7] = $vOL_P8
        $aOL_Recipients[8] = $vOL_P9
        $aOL_Recipients[9] = $vOL_P10
    Else
        $aOL_Recipients = $vOL_P1
    EndIf
    ; add recipients to the item
    For $iOL_Index = 0 To UBound($aOL_Recipients) - 1
        ; recipient is an object = recipient name already resolved
        If IsObj($aOL_Recipients[$iOL_Index]) Then
            $vOL_Item.Recipients.Add($aOL_Recipients[$iOL_Index])
            If @error Then Return SetError(3, $iOL_Index, 0)
        Else
            If StringStripWS($aOL_Recipients[$iOL_Index], 3) = "" Then ContinueLoop
            $oOL_Recipient = $oOL.Session.CreateRecipient($aOL_Recipients[$iOL_Index])
            If @error Or Not IsObj($oOL_Recipient) Then Return SetError(600 + $iOL_Index, @error, 0)
            $oOL_Recipient.Resolve
            If @error Or Not $oOL_Recipient.Resolved Then
                If Not (StringInStr($aOL_Recipients[$iOL_Index], "@")) Or Not ($bOL_AllowUnresolved) Then Return SetError(400 + $iOL_Index, @error, 0)
            EndIf
            #forceref $oOL_TempRecipient ; to prevent the AU3Check warning: $oOL_TempRecipient: declared, but not used in func.
            $oOL_TempRecipient = $vOL_Item.Recipients.Add($oOL_Recipient)
            If @error Then Return SetError(300 + $iOL_Index, @error, 0)
            $oOL_TempRecipient.Type = $iOL_Type
        EndIf
    Next
    $vOL_Item.Close(0)
    Return $vOL_Item

EndFunc   ;==>_OL_ItemRecipientAdd

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

 

Posted (edited)

that wont work will it?

if you just tell it to allow unresolved..what if its a bad email addy (not just an @ to check for)?

how about:

$oOL_Recipient.Resolve

If @error Or Not $oOL_Recipient.Resolved Then

if not ($bOL_AllowUnresolved) or (stringregexp($aOL_Recipients[$iOL_Index],"(?;)(?:b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+.)+[A-Z]{2,4}B)",0) = 0) Then

Return SetError(400 + $iOL_Index, @error, 0)

endif

EndIf

fwiw..I personally really want the regex not just an "@" check.

Edited by brycetech
Posted

that wont work will it?

if you just tell it to allow unresolved..what if its a bad email addy (not just an @ to check for)?

Did you find a combination of address, error and setting that didn't return the expected result?

I did the following tests and got correct results:

Address............................$bOL_AllowUnresolved....Resolved....Result

Name Firstname.....................True....................True........OK

Name Firstname.....................True....................False.......Error

firstname.Lastname@company.com.....True....................True........OK

firstname.Lastname@company.com.....True....................False.......OK

Name Firstname.....................False...................True........OK

Name Firstname.....................False...................False.......Error

firstname.Lastname@company.com.....False...................True........OK

firstname.Lastname@company.com.....False...................False.......Error

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

 

Posted

hi there,

iam new to this forum, but i have two questions about your outlookex udf.

is it possible to close all pst-folders with the _PSTClose function? maybe with a wildcard or something like that?

the next question is: can i close pst-folders if i just have the path to the pst-file and not the name in outlook (cause in outlook can be more than one file with the same name (for example: "Personal Archive").

thank you very much for your answer.

greetings

pax

Posted

Hi pax,

welcome to AutoIt, the OutlookEX UDF and the forum!

You can call function _OL_StoreGet to get a list of all available stores in an array. Element[$index][4] is True if it is a .pst or .ost file. To close the PST pass Element[$index][0] to function _OL_PSTClose.

If you want to close the PST by path loop through the array and comapre Element[$index][2]. if equal do as above.

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

 

Posted

Glad you like it ;)

If you have further questions I will do my very best to help.

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

 

Posted (edited)

Hi

Just an update...

this has now been running flawlessly for 3 days. It has not crashed, nor has it failed to send even one email!

I made 2 more adjustments to the error clicking script.

the checkbox only appears on one of the error windows..and while it would eventually click it, I set it so it will actually do it first shot.

my change is below...

thanx again for a really kewl script. CDO won't do what I want so this is a perfect. (the server wont relay so I cant send texts to myself with cdo)

BT

first change...I added a singleton...it seemed to start multiple instances if an error occurred so this fixed that:

############################

if _Singleton("_OL_Warnings", 0) = 0 Then

;~ consolewrite("already running" & @crlf)

Exit

endif

############################

and then second the checkbox existence:

############################

While 1

;~ consolewrite("in loop" & @crlf)

If WinExists($sWindowTitle, $sWindowText) Then

Local $aOL_WinSize = WinGetPos($sWindowTitle, $sWindowText)

ToolTip(@CRLF & "OL_Warning will automatically click these buttons" & @CRLF, $aOL_WinSize[0] + 50, $aOL_WinSize[1] + 70, "Don't touch")

While 1

WinActivate($sWindowTitle, $sWindowText)

WinWaitActive($sWindowTitle,$sWindowText,3)

If ControlCommand($sWindowTitle, $sWindowText, "Button4", "IsEnabled") Then

;~ is checkbox on this window? check by trying to obtain its position

ControlGetPos($sWindowTitle, $sWindowText, "[CLASS:Button; INSTANCE:3]")

if not @error then

;~ if it is present there is no error so this will fire ...and is it the right checkbox?

$sText = ControlGetText($sWindowTitle, $sWindowText, "[CLASS:Button; INSTANCE:3]")

if $sText = "&Allow access for" then

ControlFocus($sWindowTitle, $sWindowText, "[CLASS:Button; INSTANCE:3]")

sleep(100)

Send("{SPACE}")

endif

endif

sleep(100)

ControlFocus($sWindowTitle, $sWindowText, "[CLASS:Button; INSTANCE:4]")

sleep(100)

ControlClick($sWindowTitle, $sWindowText, "Button4")

sleep(100)

ToolTip("")

;~ consolewrite("item clicked" & @crlf)

ExitLoop

EndIf

Sleep($iOL_CtrlCheckTime)

If Not WinExists($sWindowTitle, $sWindowText) Then

;~ consolewrite("Window does not exist" & @crlf)

ExitLoop

endif

WEnd

EndIf

Sleep($iOL_WinCheckTime)

ToolTip("")

;~ looking for both process name or processID

If Not ProcessExists($iOL_ProcessID1) or not ProcessExists($iOL_ProcessID) Then

;~ consolewrite("processes do not exist" & @crlf)

Exit

endif

;~ If not ProcessExists($iOL_ProcessID) Then Exit

WEnd

############################

Edited by brycetech
  • 2 weeks later...
Posted

hi there,

Well done with this UDF! It's been a great help with a couple of scripts I'm busy with.

Was going to ask a question but sussed it out while writing ...

good work :D

Posted

Glad you like the UDF :D

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

 

Posted (edited)

Hi guys!

I am having some strange issues with the outlookex UDF, hopefully somebody can guide me into right direction.

What I want is to search the Outlook calendar for upcoming appointments. To do so I query the Calendar with

Global $aItems = _OL_ItemFind($oOutlook, $aFolder[1], $olAppointment, "[Start]>='" & @year & "-" & @MON & "-" & @MDAY& " 08:00' AND [End]<='" & @YEAR &"-" &@MON&"-"&@MDAY& " 17:10'", "", "", "Start,End,Subject", "", 1)

What the query returns is rather strange to me as it gives me just all reoccuring appointments(holidays, birthdays, jour fixe) and for start date the have the date they have been created.

But what I dont get is the test entry I created for today 11:00 - 12:00.

Now it would be great to know why my query returns all of those reoccuring objects(with the date they have been created) but not todays events.

thanks a lot in advance

best regards!

Edited by nigthlord
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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