我需要帮助在我的applescript代码中生成因变量
问题描述:
我想弄清楚如何在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&[email protected]&su=Movies&body= " & "\""
else
do shell script "open -a \"Google Chrome\" \"" & "https://mail.google.com/mail/?view=cm&fs=1&[email protected]&su=Movies&body=No thank you, thanks for the offer though " & "\""
end if
答
display dialog
返回与键text returned
,button returned
和gave 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&[email protected]&su=Movies&body=" & param)
你可以编辑你的标题,使之与你使用这段代码时有什么不满吗? –