Apple Mail: Regel zum Drucken von neuen Nachrichten

22/01/2011

Hier in kleines Skript zum direkten drucken von eintreffenden Nachrichten. Bisher sehe ich nur einen Weg über GUI-Skripting, sollte jemand eine bessere Lösung haben (ausser Quickmail als Client zu verwenden) -->Please comment!

Read the rest of this article »
2 Comments

Mail-Regel: Links laden und als PDF abspeichern

5/10/2010
Julien hat mich heute gebeten eine Möglichkeit zu finden, die Links einer Email aufzurufen und die entsprechenden Websites als PDF zu drucken. Bei der Suche nach einer Lösung bin ich auf wkpdf gestoßen. Das ist ein Ruby-Script mit dem man eine URL über das Webkit-Framework lädt und den Output als PDF abspeichern kann. Da die Installation von wkpdf so simple ist und danach einfach via do shell script abrufbar ist, eine perfekte Lösung. Als Anhang (weil durch einen sed-Befehl einige besonders besondere Sonderzeichen im Quellcode stehen). DOWNLOAD
mail_links_to_pdf v.0.1
7.36 kB (133 hits)

Anwendung

Das Skript über eine Mail-Regel anfeuern und jede Email, die auf die Mail-Regel anspringt, wird nach URLs gescannt, die URLs werden über wkpdf aufgerufen und als PDF gespeichert.

Nice2Know

Das Skript nutzt als Email-Text zur Zeit set mytext to content of thisMessage, man könnte aber auch (um auch html-Emails verarbeiten zu können set mytext to source of thisMessage auskommentieren.

Links

3 Comments

Mail-Regel-Skript: Attachments sichern

20/01/2010
Hier ein simples Skript, welches Anhänge von Emails in einem vordefinierten Ordner sichert. Das kann man an eine Mail-Regel hängen.
Code zum markieren einmal anklicken Code im Skript-Editor öffnen

-- hubionmac.com 2010-01

-- script to be added to a Apple Mail rule

--saves attachmens of new mails into a folder

on perform_mail_action(info)

tell application "Mail"

tell application "Finder" to set mypath to (folder "Mail Attachments Saved" of desktop) as text

set theMessages to |SelectedMessages| of info

repeat with thisMessage in theMessages

try

repeat with a in (every mail attachment of thisMessage)

set current_a_name to name of a

set current_a_name to my checkname_with_pdf_suffix(current_a_name, mypath as alias, false)

save a in mypath & current_a_name

end repeat

on error msg

do shell script "echo " & quoted form of msg & " | cat>>~/Desktop/MailscriptErrorLog.txt"

end try

end repeat

end tell

end perform_mail_action



on checkname_with_pdf_suffix(n, D, looped)

tell application "Finder"

set thefiles to name of every item of (D as alias)

end tell

if thefiles contains n then

if looped = false then

set n to ((characters 1 through -5 of n) & " 1" & (characters -4 through -1 of n)) as text

my checkname_with_pdf_suffix(n, D, true)

else

set tmp to (last word of ((characters 1 through -5 of n) as text) as integer)

set tmpcount to (count of characters of (tmp as text)) + 5

set tmp to tmp + 1

set n to ((characters 1 through (-1 * tmpcount) of n) & tmp & (characters -4 through -1 of n)) as text

my checkname_with_pdf_suffix(n, D, true)

end if

else

return n

end if

end checkname_with_pdf_suffix

8 Comments