我想制作一个允许您发送电子邮件的Applescript程序。 我做了这个,但它不起作用。 谁能帮我吗?
代码:
set answer1 to text returned of (display dialog "Type here your message" default answer "" buttons {"OK"} default button 1)
set answer2 to text returned of (display dialog "Type the e-mail you want to send to" default answer "" buttons {"OK"} default button 1)
set answer3 to text returned of (display dialog "Type your subject" default answer "" buttons {"OK"} default button 1)
tell application "Mail"
open "new"
delay 1
keystroke answer1
tell application "System Events" to key code 48
repeat 3 times
keystroke answer3
tell application "System Events" to key code 48
keystroke answer2
open "send"
end repeat
end tell
希望你们中的任何人都能知道我能做些什么。
答案 0 :(得分:0)
嗯,如上所述,'系统事件'不是要走的路。这是我认为你想要做的一种方法:
set answer1 to text returned of (display dialog "Type here your message" default answer "" buttons {"OK"} default button 1)
set answer2 to text returned of (display dialog "Type the e-mail you want to send to" default answer "" buttons {"OK"} default button 1)
set answer3 to text returned of (display dialog "Type your subject" default answer "" buttons {"OK"} default button 1)
tell application "Mail"
set myMessage to make new outgoing message with properties {visible:true, subject:answer3, content:answer1}
tell myMessage
make new to recipient with properties {name:answer2, address:answer2}
send
end tell
end tell