• Das kreative Thema des Monats Oktober wird vor allem diejenigen unter Euch besonders ansprechen, denen Do-it-yourself quasi im Blut liegt. Zeigt uns Eure Improvisationskünste oder fotografiert, was andere Leute sich so im Alltag zusammengestrickt haben. --> Zum Mitmachen bitte hier klicken

AppleScript - Empfänger aus Zwischenablage einfügen

  • Ersteller Ersteller Mitglied 59480
  • Erstellt am Erstellt am

Mitglied 59480

Gast
Hi,

ich brauche für die Arbeit ein AppleScript, welches eine neue Email generiert mit der Besonderheit, dass der Empfänger der Email immer unterschiedlich ist. Ich möchte quasi, dass ein kopierter Text (die Emailadresse des Empfängers) aus der Zwischenablage in das "An" Feld bei AppleMail kopiert wird. So weit verständlich?

Ich habe im Grunde das wichtigste Schript schon vorliegen:

Neue Email mit Betreff und Empfänger:
Code:
tell application "Mail"
    set newMessage to make new outgoing message with properties {subject:"Der Betreff", content:"" & return & return}
    tell newMessage
        set visible to true
        make new to recipient at end of to recipients with properties {address:"die adresse..."}
    end tell
    activate
end tell

Jemand eine Idee?
 
Hallo,

set dest to the clipboard
tell ...
{address:dest}


Gruß
 
Hi,

danke für die Antwort. Ich habe das ganze in der Zwischenzeit selber lösen können, wenn auch etwas umfangreicher:

Code:
set thetext to the text returned of (display dialog "Gib deine Emailadresse ein…" default answer "")
set the clipboard to thetext

tell application "Mail"
    
    set newMessage to make new outgoing message with properties {subject:"Backup", content:"" & return & return}
    tell newMessage
        set visible to true
    end tell
    activate
    tell application "System Events"
        keystroke "v" using {command down}
    end tell
    
end tell
 
So geht's richtig:

Code:
[B]set[/B] [COLOR=#4F8F00]thetext[/COLOR] [B]to[/B] [B]the[/B] [COLOR=#5730BE]text returned[/COLOR] [B]of[/B] ([COLOR=#012FBE][B]display dialog[/B][/COLOR] "Gib deine Emailadresse ein…" [COLOR=#012FBE]default answer[/COLOR] "")
[B]tell[/B] [COLOR=#0433ff][I]application[/I][/COLOR] "Mail"
[COLOR=#0433FF][COLOR=#000000]    [B]set[/B] [/COLOR][COLOR=#4f8f00]theMessage[/COLOR][COLOR=#000000] [B]to [/B] [/COLOR][B]make new[/B] [I]outgoing message [/I]with properties[COLOR=#000000] {[/COLOR][COLOR=#812fdc]visible[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#812fdc][I]true[/I][/COLOR][COLOR=#000000], [/COLOR][COLOR=#812fdc]subject[/COLOR][COLOR=#000000]:"Backup"}[/COLOR][/COLOR]
[COLOR=#4F8F00][COLOR=#000000]    [B]tell[/B] [/COLOR]theMessage[/COLOR]
[COLOR=#0433FF][COLOR=#000000]        [/COLOR][B]make [/B]new [I]to recipient [/I]at[COLOR=#000000] [B]end[/B] [B]of[/B] [/COLOR][I]to recipients [/I]with properties[COLOR=#000000] {[/COLOR][COLOR=#812fdc]address[/COLOR][COLOR=#000000]:[/COLOR][COLOR=#4f8f00]thetext[/COLOR][COLOR=#000000]}[/COLOR][/COLOR]
    [B]end[/B] [B]tell[/B]
[B]end[/B] [B]tell[/B]