AppleScript iMessage 到 SMS 帐户无法正常工作 MacOSX Sonoma

问题描述 投票:0回答:1

尝试编写一个脚本来解析 Excel 文件并将 SMS/iMessage 发送到文件中的所有列表。脚本适用于除 SMS 类型之外的所有类型。请帮忙。

将 file_Name 设置为“/Target.xlsx” 将 messageToSend 设置为“测试我编写的用于发送大量短信的应用程序。忽略即可。” 将问候语设置为“下午好”

告诉应用程序“Microsoft Excel” 激活 打开文件_名称

tell active sheet
    tell used range
        set RowCount to count of rows
    end tell
    log "RowCount is " & RowCount
end tell -- active sheet   

结束告诉——申请

将 IncrementValue 从 1 重复到 RowCount 告诉应用程序“Microsoft Excel”

    tell active sheet
        set theCell to "A" & theIncrementValue & ":A" & theIncrementValue
        log "theCell is " & theCell
        set phone to string value of range theCell as string
        log "number  is " & phone
        
        set theCell to "B" & theIncrementValue & ":B" & theIncrementValue
        log "theCell is " & theCell
        set recipient to get value of range theCell as string
        log "Name is " & recipient
        
        tell application "Messages"
            set phoneNumber to phone
            set persMessageToSend to greeting & " " & recipient & ", " & messageToSend
            
            try
                set iMessageService to (1st account whose service type = iMessage)
                set iMessageBuddy to participant phoneNumber of iMessageService
                send persMessageToSend to iMessageBuddy
                log ("sent as iMessage to: " & phoneNumber)
            on error
                try
                    set iMessageService to (1st account whose service type = SMS)
                    set iMessageBuddy to participant phoneNumber of iMessageService
                    send persMessageToSend to iMessageBuddy
                    log ("sent as SMS to: " & phoneNumber)
                on error
                    log ("ERROR: COULD NOT SEND TO: " & phoneNumber)
                end try
            end try
        end tell
    end tell -- active sheet
end tell -- application  

结束重复

错误:每次发送到短信号码时都无法发送火情。

applescript sms imessage
1个回答
0
投票

这部分脚本适用于 Sequoia 15.01:

tell application "Messages"

        -- set iMessageService to (1st account whose service type = iMessage)

        set iMessageService to (1st account whose service type = SMS)

        set iMessageBuddy to participant "18885551212" of iMessageService

        send "Hello!" to iMessageBuddy

 end tell

我没有安装 Sonoma,无法在该系统上进行测试。

© www.soinside.com 2019 - 2024. All rights reserved.