• Mail in 10.14 – Entfernte Inhalte laden

    Schon ewig nervte es mich, dass ich bei vielen Nachrichten mit der Maus auf den Button 'Entfernte Inhalte laden' klicken muss, da der Default-Ablauf eben keine versteckten Inhalte laden darf.
    Nach endlosem Graben und Probieren habe ich jetzt ein Skript zusammengestellt, welches als Inhalt eines Workflows dienen kann – der dann per Tastenkürzel aufgerufen werden kann –– und in Mail den Button klickt. Trara.

    Hier der Code zum Workflow



    Show Plain Text
    1. tell application "Mail"
    2.   try
    3.     if first window is window of front message viewer then
    4.       my messageViewer()
    5.     else
    6.       my regularmessage()
    7.     end if
    8.   on error theError
    9.     my regularmessage()
    10.   end try
    11. end tell
    12. on messageViewer()
    13.   tell application "System Events" to tell process "Mail"
    14.     set mainWindow to the first window
    15.     set rootSplitter to the first splitter group of the mainWindow
    16.     set firstSplitter to the last splitter group of the rootSplitter
    17.     set scrollArea to the last scroll area of the firstSplitter
    18.     set scrollGroup to the first group of the scrollArea
    19.     if number of groups of the scrollGroup is greater than 1 then
    20.       set maybeRemoteContentGroup to the first group of the scrollGroup
    21.       if number of buttons of the maybeRemoteContentGroup is greater than or equal to 1 then
    22.         set maybeRemoteContentButton to the first button of the maybeRemoteContentGroup
    23.         if name of the maybeRemoteContentButton contains "Entfernte Inhalte laden" then
    24.           click the maybeRemoteContentButton
    25.         else
    26.           name of the maybeRemoteContentButton
    27.         end if
    28.       else
    29.         UI elements of maybeRemoteContentGroup
    30.       end if
    31.     else
    32.       UI elements of the scrollGroup
    33.     end if
    34.   end tell
    35. end messageViewer
    36. on regularmessage()
    37.   tell application "System Events" to tell process "Mail"
    38.     set mainWindow to the first window
    39.     set mainScrollGroup to the first scroll area of the mainWindow
    40.     set everyMessage to every group of the mainScrollGroup
    41.     log (number of everyMessage)
    42.     repeat with currentMessage in everyMessage
    43.       set loadRemoteContentButton to the first button of the first group in the currentMessage
    44.       click the loadRemoteContentButton
    45.     end repeat
    46.   end tell
    47. end regularmessage


    Anmerkungen:
    1) Der Button, der zu klicken ist, hat hier eine deutsche Beschriftung (Zeile 23), muss also eventuell angepasst werden (load remote content auf englischen Systemen).
    2) Wenn fremde Erweiterungen wie MailButler vorhanden sind, muss wohl first button in Zeile 22 gesetzt werden, ansonsten wohl last button
    ----------
    macOS 10.4, 10.14, 10.15, 11, 12, 13 sowie iOS 12, 15 und 17