[英]Applescript Editor typing text in an e-mail
I wanted to make an Applescript program that allows you to send an e-mail. 我想制作一个Applescript程序,使您可以发送电子邮件。 I made this but it won't work.
我做了这个,但是没用。 Can anyone help me out?
谁能帮我吗?
Code: 码:
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
Hope anyone of you can find out what I can do. 希望你们中的任何人都能找到我能做的。
Well, as mentioned, 'System Events' is not the way to go. 好吧,正如所提到的,“系统事件”不是要走的路。 Here's an approach to what I think you're trying to do:
这是我认为您要尝试执行的操作的一种方法:
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.