- Registriert
- 02.07.12
- Beiträge
- 5
Hallo ,
ich habe ein Shell Script welches mir eine Logdatei von einem UNIX Server holt und dies in eine PDF Datei umwandelt. Bis hierher funktioniert noch alles.
Ich sollte gleich sagen, dass ich AppleScript Neuling bin und nicht weiss was ich da tue. Ich hoffe aber mit solchen kleinen Anforderung mich schnell in die Materie einzuarbeiten ;O)
Nun möchte ich diese PDF Datei per E-Mail über AppleScript verschicken. Ich habe mich hier im Forum schon umgesehen und einen Beitrag gefunden der ein ähnliches Thema behandelt. Daraufhin habe ich das AppleScript von Doug Adams ein wenig an meine Bedürfnisse angepasst.
Es wird auch eine E-Mail erstellt. Der Text für den Anhang wird angezeigt. Die Betreffzeile ist in Ordnung. Leider wird aber weder der Empfänger, noch der Absender noch die PDF Datei als Anhang hinzugefügt. :-c
Folgender Aufruf startet das AppleScript:
Hier das angepasste AppleScript:
Fein wäre auch, wenn ich angeben könnte welche Signatur verwendet werden sollte und dass die E-Mail als Text und nicht als HTML E-Mail versendet wird. Kann mir jemand auf die Sprünge helfen?
Besten Dank schon mal...
ascotmac
ich habe ein Shell Script welches mir eine Logdatei von einem UNIX Server holt und dies in eine PDF Datei umwandelt. Bis hierher funktioniert noch alles.
Ich sollte gleich sagen, dass ich AppleScript Neuling bin und nicht weiss was ich da tue. Ich hoffe aber mit solchen kleinen Anforderung mich schnell in die Materie einzuarbeiten ;O)
Nun möchte ich diese PDF Datei per E-Mail über AppleScript verschicken. Ich habe mich hier im Forum schon umgesehen und einen Beitrag gefunden der ein ähnliches Thema behandelt. Daraufhin habe ich das AppleScript von Doug Adams ein wenig an meine Bedürfnisse angepasst.
Es wird auch eine E-Mail erstellt. Der Text für den Anhang wird angezeigt. Die Betreffzeile ist in Ordnung. Leider wird aber weder der Empfänger, noch der Absender noch die PDF Datei als Anhang hinzugefügt. :-c
Folgender Aufruf startet das AppleScript:
Code:
[email protected]
Betr=Konfiguration
[email protected]
FileName=<PfadtoKonfDatei>/20120629_TS-log.pdf
Zusatz="Radkappe"
osascript conf_pdf2e-mail.scpt "${Empf}" "${Betr}" "${Abs}" "${FileName}" "${Zusatz}"
Hier das angepasste AppleScript:
Code:
[B]property[/B] [COLOR=#498f2a]mailSubjectPrefix[/COLOR] : "Konfiguration: "
[B]property[/B] [COLOR=#498f2a]attachSeparator[/COLOR] : "*******"
[B]property[/B] [COLOR=#498f2a]attachPrefix[/COLOR] : "Konfiguration:"
[B]on[/B] [COLOR=#053df5][B]run[/B][/COLOR] [COLOR=#498f2a]argv[/COLOR]
[COLOR=#5e6161][COLOR=#000000] [/COLOR](*[/COLOR]
[COLOR=#5e6161] "Selected Tracks As Mail Attachment" for iTunes[/COLOR]
[COLOR=#5e6161] written by Doug Adams[/COLOR]
[COLOR=#5e6161] [email protected][/COLOR]
[COLOR=#5e6161]
[/COLOR]
[COLOR=#5e6161] v1.0 july 29 2006[/COLOR]
[COLOR=#5e6161] -- initial release[/COLOR]
[COLOR=#5e6161]
[/COLOR]
[COLOR=#5e6161] Get more free AppleScripts and info on writing your own[/COLOR]
[COLOR=#5e6161] at Doug's AppleScripts for iTunes[/COLOR]
[COLOR=#5e6161] http://www.dougscripts.com/itunes/[/COLOR]
[COLOR=#5e6161] *)[/COLOR]
[B]tell[/B] [COLOR=#053df5][I]application[/I][/COLOR] "Mail"
[B]set[/B] [COLOR=#498f2a]mailSubject[/COLOR] [B]to[/B] [COLOR=#053df5][I]item[/I][/COLOR] 2 [B]of[/B] [COLOR=#498f2a]argv[/COLOR]
[B]set[/B] [COLOR=#053df5][B]mailto[/B][/COLOR] [B]to[/B] [COLOR=#053df5][I]item[/I][/COLOR] 1 [B]of[/B] [COLOR=#498f2a]argv[/COLOR]
[B]set[/B] [COLOR=#498f2a]mailfrom[/COLOR] [B]to[/B] [COLOR=#053df5][I]item[/I][/COLOR] 3 [B]of[/B] [COLOR=#498f2a]argv[/COLOR]
[COLOR=#053df5][COLOR=#000000] [B]set[/B] [/COLOR][COLOR=#498f2a]new_mess[/COLOR][COLOR=#000000] [B]to[/B] [/COLOR][B]make[/B]new[I]outgoing message[/I][/COLOR]
[COLOR=#498f2a][COLOR=#000000] [B]tell[/B] [/COLOR]new_mess[/COLOR]
[B]set[/B] [COLOR=#8436d3]visible[/COLOR] [B]to[/B] [COLOR=#5f348c]true[/COLOR]
[COLOR=#5e6161][COLOR=#000000] [/COLOR]--set content to (fnoms & return & content)[/COLOR]
[COLOR=#5e6161][COLOR=#000000] [/COLOR]--set content to (return & attachSeparator & return & attachPrefix & return & return)[/COLOR]
[COLOR=#8436d3][COLOR=#000000] [B]set[/B] [/COLOR]content[COLOR=#000000] [B]to[/B] ([/COLOR]return[COLOR=#000000] & [/COLOR][COLOR=#498f2a]attachPrefix[/COLOR][COLOR=#000000] & [/COLOR]return[COLOR=#000000] & [/COLOR]return[COLOR=#000000])[/COLOR][/COLOR]
[COLOR=#5e6161][COLOR=#000000] [/COLOR]--repeat with this_atch in atch[/COLOR]
[B]tell[/B] [COLOR=#8436d3]content[/COLOR]
[COLOR=#5e6161][COLOR=#000000] [/COLOR]-- make new attachment with properties {file name:item 4 of argv} at after last paragraph -- at after the last word of the second paragraph[/COLOR]
[COLOR=#053df5][COLOR=#000000] [/COLOR][B]make [/B]new [I]attachment [/I]with properties[COLOR=#000000] {[/COLOR][COLOR=#8436d3]file name[/COLOR][COLOR=#000000]:[/COLOR][I]item[/I][COLOR=#000000] 4 [B]of[/B] [/COLOR][COLOR=#498f2a]argv[/COLOR][COLOR=#000000]}[/COLOR][/COLOR]
[B]end[/B] [B]tell[/B]
[COLOR=#5e6161][COLOR=#000000] [/COLOR]-- tell application "Finder" to set mailSubject to mailSubject & name of item 4 of argv & space [/COLOR]
[COLOR=#5e6161][COLOR=#000000] [/COLOR]--end repeat[/COLOR]
[B]set[/B] [COLOR=#8436d3]subject[/COLOR] [B]to[/B] [COLOR=#498f2a]mailSubjectPrefix[/COLOR] & [COLOR=#053df5][I]item[/I][/COLOR] 2 [B]of[/B] [COLOR=#498f2a]argv[/COLOR] & " " & [COLOR=#053df5][I]item[/I][/COLOR] 5 [B]of[/B] [COLOR=#498f2a]argv[/COLOR]
[B]end[/B] [B]tell[/B]
[COLOR=#053df5][COLOR=#000000] [/COLOR][B]activate[/B][/COLOR]
[B]end[/B] [B]tell[/B]
[B]end[/B] [COLOR=#053df5][B]run[/B][/COLOR]
Fein wäre auch, wenn ich angeben könnte welche Signatur verwendet werden sollte und dass die E-Mail als Text und nicht als HTML E-Mail versendet wird. Kann mir jemand auf die Sprünge helfen?
Besten Dank schon mal...
ascotmac