我需要帮助在我的AppleScript代码中创建一个因变量

时间:2017-08-26 18:13:11

标签: email dialog applescript

我正在试图弄清楚如何使用AppleScript进行编码,你可以通过阅读代码来弄清楚我在做什么。

我的目标是将文本框放在电子邮件正文中。我可以在代码中使用一些帮助。

如果有人可以转移它,比如JavaScript或其他很好的东西。

display dialog "Hey, Would You Like To Go To A Movie Sometime?" default answer linefeed buttons {"Yeah, I'd Love To", "No Thanks"} default button "Yeah, I'd Love To"
set the choice to the button returned of the result
if the choice is "Yeah, I'd Love To" then
    do shell script "open -a \"Google Chrome\" \"" & "https://mail.google.com/mail/?view=cm&fs=1&to=owenemcg@gmail.com&su=Movies&body= " & "\""
else
    do shell script "open -a \"Google Chrome\" \"" & "https://mail.google.com/mail/?view=cm&fs=1&to=owenemcg@gmail.com&su=Movies&body=No thank you, thanks for the offer though " & "\""
end if

1 个答案:

答案 0 :(得分:0)

display dialog会返回包含密钥text returnedbutton returnedgave up的记录。您还需要考虑text returned

set {text returned:textReturned, button returned:buttonReturned} to display dialog "Hey, Would You Like To Go To A Movie Sometime?" default answer linefeed buttons {"Yeah, I'd Love To", "No Thanks"} default button "Yeah, I'd Love To"
if buttonReturned is "Yeah, I'd Love To" then
    set param to textReturned
else
    set param to "No thank you, thanks for the offer though"
end if

do shell script "open -a 'Google Chrome' " & quoted form of ("https://mail.google.com/mail/?view=cm&fs=1&to=owenemcg@gmail.com&su=Movies&body=" & param)