Applescript 编写一个苹果脚本,通过数字发送电子邮件

Applescript 编写一个苹果脚本,通过数字发送电子邮件,applescript,spreadsheet,Applescript,Spreadsheet,因此,我正在尝试编写一个苹果脚本,将电子邮件以数字形式发送到选定的信息块 数字的格式如下: 以下是我的苹果脚本: on run {input, parameters} if the class of input is not string then set input to input as string set currentRow to my theSplit(input, "*") set row to 1 repeat while row <= (count of curr

因此,我正在尝试编写一个苹果脚本,将电子邮件以数字形式发送到选定的信息块

数字的格式如下:

以下是我的苹果脚本:

on run {input, parameters}
if the class of input is not string then set input to input as string

set currentRow to my theSplit(input, "*")

set row to 1

repeat while row <= (count of currentRow)

    set fullInput to {}
    set fullInput to my theSplit(item row of currentRow, "  ")
    set row to row + 1

    set theName to ""
    if item 2 of fullInput is "" then
        set theName to item 1 of fullInput
    else
        set theName to item 2 of fullInput
    end if

    set theContent to "Hello " & theName & ", Email Body"

    tell application "Mail"
        set thisMessage to make new outgoing message with properties {subject:"HTML5 Game Sponsorships", content:theContent}
        tell thisMessage
            make new to recipient with properties {address:(item 3 of fullInput)}
            set visible to true

        end tell
    end tell

end repeat

end run
运行时{input,parameters}
如果输入类不是string,则将input设置为input为string
将currentRow设置为my theSplit(输入“*”)
将行设置为1

重复上述步骤,您可以尝试使用以下方法修剪公司名称中固有的回车:

set theName to characters 2 thru -1 of (item 1 of fullInput)

这会将其设置为第二个到最后一个字符。(-1表示最后一个,-2是最后一个等的第二个。)

请您不要发布AppleScript代码的屏幕截图,而是发布实际代码,以便其他人可以复制代码,在脚本编辑器中使用它来测试和解决您的问题?好了!我最初在苹果社区上发布了这篇文章,当我粘贴代码时,它破坏了所有的格式,所以我只是把它做成了一张图片。然后在我有一段时间没有收到任何回复后,就把帖子复制到这里。这会有用的,但第一次它只是发布了公司名称,没有回车。最后,我只是在开始时放置了另一列单元格作为缓冲区。工作得很好,用我的脚本发送了大约100封电子邮件。