Outlook neue Email

  • Hi,

    da Outlook immer nur sehr kurz eine Meldung anzeigt wenn eine neue Email vorhanden ist, habe ich mal ein kleines Script geschrieben das das ganze dauerhaft anzeigt bis man es weg klickt.
    Ist nichts großes, einfach nur kleines Infofenster. Benötigt wird die OutlookUDF: klick mich

    Spoiler anzeigen
    [autoit]

    #include <Outlook.au3>
    #include <GDIPlus.au3>
    #include <GUIConstantsEx.au3>

    [/autoit] [autoit][/autoit] [autoit]

    AdlibRegister("_getemail", 300000)
    Global $gui
    $sichtbar = False
    $guiwidth = 100

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    GUIDelete($gui)
    $sichtbar = False
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _getemail()
    If $sichtbar = False Then
    $ol = _OutlookOpen()
    $mail = _OutlookGetMail($ol, 6, False, "", "", "", "", "", "", True)
    $gui = GUICreate("Neue Email", $guiwidth, 65 * $mail[0][1], -1, -1)
    GUISetBkColor(0xFFFF00)
    If $mail[0][1] > 0 Then
    For $i = 1 To $mail[0][1] Step 1
    If $i = 1 Then
    $top = 8
    Else
    $top = (64 * ($i - 1)) + 8
    EndIf
    $absenderwidth = _textlaenge($mail[$i][0])
    $betreffwidth = _textlaenge($mail[$i][7])

    [/autoit] [autoit][/autoit] [autoit]

    If $absenderwidth > $betreffwidth Then
    $width = $absenderwidth
    Else
    $width = $betreffwidth
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $width > $guiwidth Then
    $guiwidth = $width + 20
    EndIf

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    WinMove("Neue Email", "", (@DesktopWidth / 2) - ($guiwidth / 2), (@DesktopHeight / 2) - ((65 * $mail[0][1]) / 2), $guiwidth)

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlCreateLabel($mail[$i][0] & @CRLF & $mail[$i][7], 0, $top, $width, 50)
    GUICtrlSetFont(-1, 12, 400, 0, "Arial")
    Next

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW)
    $sichtbar = True
    EndIf
    _OutlookClose()
    EndIf
    EndFunc ;==>_getemail

    [/autoit] [autoit][/autoit] [autoit]

    Func _textlaenge($text)
    If $text = '' Then Return
    _GDIPlus_Startup()
    Local $hFormat = _GDIPlus_StringFormatCreate(0)
    Local $hFamily = _GDIPlus_FontFamilyCreate("Arial")
    Local $hFont = _GDIPlus_FontCreate($hFamily, 12, 0, 3)
    Local $tLayout = _GDIPlus_RectFCreate(15, 171, 0, 0)
    Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($gui)
    Local $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $text, $hFont, $tLayout, $hFormat)
    Local $iWidth = Ceiling(DllStructGetData($aInfo[0], "Width"))
    ;Local $iHeight = Ceiling(DllStructGetData($aInfo[0], "Height"))
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_FontDispose($hFont)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    Return $iWidth
    EndFunc ;==>_textlaenge

    [/autoit]

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

  • Sollte laufen, zumindestens mit 2000,2003 und 2010 läuft es.

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.