号码|电子邮件| AppleScript的 [英] Numbers | Email | Applescript
问题描述
我想创建一个时S preadsheet。在注意到s preadsheet我想有COL电子邮件色柱B城市名称COL C其他城市名称等。我将手动输入中的数据。
我想下一步要做的是有AppleScript的经历一行一行的时S preadsheet并发送电子邮件给每个人在列。我想用在电子邮件主题或正文中的其他变量。
任何帮助将是AP preciated!我在最好的程序员新手。我知道蟒蛇小一点,但相信新的AppleScript。
伪code(也许?)
告诉编号,以开放源代码preadsheet
重复对于s preadsheet的每一行
告诉邮件创建电子邮件
对于地址柱A
为主题的Hello(COL B)我需要以下资料(COL C)
电子邮件身体等等等等等等(西D)等等等等。
发电子邮件
重复结束
电子邮件功能
上的电子邮件(A,B,C,D)
RECIPIENTNAME设置为
设置recipientAddress为b
设置theSubject给C&放; - >中和放大器; D&安培; 装船
设置theContent到A和,如果你想与您的货物从移动服务&放大器; C&安培; 以与& D&安培; 或者你可能有任何其他的货物,请让我知道,我们在你准备接客经营区域的驱动程序。 告诉应用程序邮件 ##创建消息
设置theMessage做出新的传出消息具有属性{主题:theSubject,内容:theContent,可见:真正} ##集的收件人
告诉theMessage
使新的收件人具有属性{名称:RECIPIENTNAME,地址:recipientAddress} ##发送消息
发送 告诉结束
告诉结束
结束电子邮件 我的电子邮件(COL A,COL B,COL C,COL D)
这是我砍死在一起!我是一个新手,所以要温柔。改进和批评都大大AP preciated!
上的电子邮件(电子邮件,姓名,出发地,目的地)
RECIPIENTNAME设置为名称
设置recipientAddress到电子邮件
设置theSubject为C&放大器; - >中和放大器; D&放大器; 装船
设置theContent人名和放大器; ,如果你想与您的货物从移动服务&放大器; C和安培; 以与& D&放大器; 或者你可能有任何其他的货物,请让我知道,我们在你准备接客经营区域的驱动程序。 告诉应用程序邮件 ##创建消息
设置theMessage做出新的传出消息具有属性{主题:theSubject,内容:theContent,可见:真正} ##集的收件人
告诉theMessage
使新的收件人具有属性{名称:RECIPIENTNAME,地址:recipientAddress} ##发送消息
发送 告诉结束
告诉结束
结束电子邮件在recipientNames()
设置y以1为字符串
告诉应用程序数字
启用
开放别名的Macintosh HD:用户:TYPKRFT:桌面:Form.numbers
告诉文档1张1表1
集myNames到{}
与我重复1到的行数
集合X为B&放大器; ÿ
设置myNames为myNames&安培;小区x的值
Ÿ设置为y为整数
集y以Y + 1
Ÿ设置为y为字符串
重复结束
告诉结束
告诉结束 设置itemsToDelete为{缺失值,姓名,缺失值,停止} 集cleanNames到{} 与我再说一遍,从1数myNames
如果{myNames的项目i}不在itemsToDelete然后设置cleanNames年底前myNames的项目我
重复结束
返回cleanNames
结束recipientNames在EMAILADDRESS()
设置y以1为字符串
告诉应用程序数字
启用
开放别名的Macintosh HD:用户:TYPKRFT:桌面:Form.numbers
告诉文档1张1表1
集myEmails到{}
与我重复1到的行数
集合X为C&放大器; ÿ
设置myEmails为myEmails&安培;小区x的值
Ÿ设置为y为整数
集y以Y + 1
Ÿ设置为y为字符串
重复结束
告诉结束
告诉结束 设置itemsToDelete为{缺失值,电子邮件,缺失值,停止} 集cleanEmails到{} 与我再说一遍,从1数myEmails
如果{myEmails的项目i}不在itemsToDelete然后设置cleanEmails年底前myEmails的项目我
重复结束
返回cleanEmails
结束EMAILADDRESS一个设置为EMAILADDRESS()
设置b,来我recipientNames()
集代表来算的
集合X为1
重复多次代表
设置电子邮件到的项x
设置名称项X B的
我的电子邮件(电子邮件,名称)
集x到x + 1
重复结束
I would like to create a numbers spreadsheet. In that spreadsheet I want to have COL A Email Col B City Name COL C Other City Name and so on. I will manually enter that data in.
What I would like to do next is have applescript go through line by line in the numbers spreadsheet and send an email to each person in the column. I would like to use the other variables in the subject or body of the email.
Any help would be appreciated! I am a novice at best programmer. I know a small bit of python but am new to applescript.
Pseudo code (maybe?)
tell numbers to open spreadsheet
repeat for each line of spreadsheet
tell mail to create email
for address COL A
for subject "Hello (COL B) I need the following Information (COL C)
for email Body "Blah Blah Blah (Col D) blah blah."
send email
end repeat
Email Function
on email(a, b, c, d)
set recipientName to a
set recipientAddress to b
set theSubject to c & " --> " & d & "Shipment"
set theContent to a & ", if you would like assistance with your shipment moving from " & c & " to " & d & " , or any other shipment you may have, please let me know. We have drivers available in your Area of Operations ready for pick up."
tell application "Mail"
##Create the message
set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
##Set a recipient
tell theMessage
make new to recipient with properties {name:recipientName, address:recipientAddress}
##Send the Message
send
end tell
end tell
end email
my email(COL A, COL B, COL C, COL D)
This is what I hacked together! I'm a newbie so be gentle. Improvements and critiques are greatly appreciated!
on email(emails, names, origin, destination)
set recipientName to names
set recipientAddress to emails
set theSubject to "c" & " --> " & "d" & "Shipment"
set theContent to names & ", if you would like assistance with your shipment moving from " & "c" & " to " & "d" & " , or any other shipment you may have, please let me know. We have drivers available in your Area of Operations ready for pick up."
tell application "Mail"
##Create the message
set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
##Set a recipient
tell theMessage
make new to recipient with properties {name:recipientName, address:recipientAddress}
##Send the Message
send
end tell
end tell
end email
on recipientNames()
set y to 1 as string
tell application "Numbers"
activate
open alias "Macintosh HD:Users:TYPKRFT:Desktop:Form.numbers"
tell table 1 of sheet 1 of document 1
set myNames to {}
repeat with i from 1 to the count of rows
set x to "B" & y
set myNames to myNames & the value of the cell x
set y to y as integer
set y to y + 1
set y to y as string
end repeat
end tell
end tell
set itemsToDelete to {"missing value", "Name", missing value, "stop"}
set cleanNames to {}
repeat with i from 1 to count myNames
if {myNames's item i} is not in itemsToDelete then set cleanNames's end to myNames's item i
end repeat
return cleanNames
end recipientNames
on emailAddress()
set y to 1 as string
tell application "Numbers"
activate
open alias "Macintosh HD:Users:TYPKRFT:Desktop:Form.numbers"
tell table 1 of sheet 1 of document 1
set myEmails to {}
repeat with i from 1 to the count of rows
set x to "C" & y
set myEmails to myEmails & the value of the cell x
set y to y as integer
set y to y + 1
set y to y as string
end repeat
end tell
end tell
set itemsToDelete to {"missing value", "Email", missing value, "stop"}
set cleanEmails to {}
repeat with i from 1 to count myEmails
if {myEmails's item i} is not in itemsToDelete then set cleanEmails's end to myEmails's item i
end repeat
return cleanEmails
end emailAddress
set a to emailAddress()
set b to my recipientNames()
set reps to count of a
set x to 1
repeat reps times
set emails to item x of a
set names to item x of b
my email(emails, names)
set x to x + 1
end repeat
这篇关于号码|电子邮件| AppleScript的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!