OK, verstehe, danke für die Erläuterung.
Die Routine funktioniert jetzt auch mit der coolen Event-Steuerung
C
#AutoIt3Wrapper_Au3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#AutoIt3Wrapper_Au3Check_Stop_OnWarning=Y
#include <OutlookEX.au3>
; *****************************************************************************
; Handle Outlook NewmailEX event when a new mail arrives.
; This script send a mail to the current user and show after mail arrival the transfer time in seconds.
; Mail delivery end the script, otherwise it loops until Shift-Alt-E is pressed.
; *****************************************************************************
HotKeySet("+!e", "_Exit") ;Shift-Alt-E to Exit the script
MsgBox(64, "Autoit Script", "Click OK to send a testmail. If no mail is received you can interrupt the script with Hotkey: 'Shift-Alt-E'!")
$oOL = _OL_Open()
Global $oOApp = ObjCreate("Outlook.Application")
Global $test = ObjEvent($oOApp, "oOApp_")
Global $sCurrentUser = $oOL.GetNameSpace("MAPI").CurrentUser.Name
Local $begin = TimerInit()
_OL_Wrapper_SendMail($oOL, $sCurrentUser, "", "", "TestA123", "Hallo, dies ist eine Testmail.", "C:\Temp\Anhang.ppt", $olFormatHTML, $olImportanceHigh)
While 1
Sleep(10)
WEnd
Func oOApp_NewMailEx($sOL_EntryId)
Local $oOL_Item = $oOApp.Session.GetItemFromID($sOL_EntryId, Default)
Local $dif = TimerDiff($begin)/1000
MsgBox(0, "Mail Send to Receive in sec", $dif)
Exit
EndFunc ;==>oOApp_NewMailEx
Func _Exit()
Exit
EndFunc ;==>_Exit
Alles anzeigen