2014-09-02 21 views
0

我希望能夠將對話框的輸出發送到我的電子郵件。做這樣的事情最好的方法是什麼?如何將對話框的輸出發送到電子郵件地址

這將是什麼樣的是這樣的:

repeat 
    display dialog "Enter some text:" buttons {"Git Goin"} default answer "" 
    set theNewInfo to text returned of result 
    if theNewInfo ≠ "" then exit repeat 
end repeat 

及其在概念證明一個非常簡單的腳本,但我要的是如下:當他們進入任何文本對話框,用於該文本將被髮送到我的電子郵件,無論它包含什麼。主題會說「NewInfo」,並且主體將包含輸入到對話框中的文本

回答

0

您應該發佈您擁有的代碼......太多問題仍然能夠可靠地回答你。你想要發送給電子郵件的是什麼?電子郵件阿迪?學科?身體? 基本上,您捕獲對話框的結果,然後將其放入「mailto:」URL字符串中,然後使用URL上的「打開位置」。這應該足以讓你開始:

set dialogResult to display dialog "Enter the subject" default answer "My subject" buttons {"[email protected]", "[email protected]"} default button 1 

set theAddress to button returned of dialogResult 
set theSubject to text returned of dialogResult 
set theBody to "This%20is%20the%20body%20text:%0AMore%20text" 

-- Must encode entities, spaces as %20 and line breaks as %0A (%0D%0A), etc. 
set theSubject to findReplace(" ", "%20", theSubject) 
set theSubject to findReplace(return, "%0A", theSubject) 

set theURL to "mailto:" & theAddress & "?subject=" & theSubject & "&body=" & theBody 

open location theURL 

on findReplace(f, r, s) 
    set otid to AppleScript's text item delimiters 
    set AppleScript's text item delimiters to f 
    set s to text items of s 
    set AppleScript's text item delimiters to r 
    set s to s as string 
    set AppleScript's text item delimiters to otid 
    return s 
end findReplace 
相關問題