Applescript 预期的行尾等,但发现&引用&引用;

Applescript 预期的行尾等,但发现&引用&引用;,applescript,imessage,Applescript,Imessage,其他人给了我以下脚本,帮助我将iMessages转发到另一个SMS电话号码。话虽如此,我对这方面真的不是很精通。任何帮助都将不胜感激。我收到了错误“预期的行尾等,但在突出显示我的电话号码之前找到了带引号的“”。我还附上了错误的屏幕截图 提前谢谢你 -- Replace below with your username property db : {Messages:"/Users/briankachmarck/Library/Messages/chat.db"} -- Ru

其他人给了我以下脚本,帮助我将iMessages转发到另一个SMS电话号码。话虽如此,我对这方面真的不是很精通。任何帮助都将不胜感激。我收到了错误“预期的行尾等,但在突出显示我的电话号码之前找到了带引号的“”。我还附上了错误的屏幕截图

提前谢谢你

-- Replace below with your username
property db : {Messages:"/Users/briankachmarck/Library/Messages/chat.db"}

-- Run an SQL query on the messages database via shell script
set Messages to do shell script (["sqlite3 -line ", ¬
    quoted form of (Messages in db) as text, ¬
    " 'SELECT MAX(date) lastMessageDate, h.id, text, guid", ¬
    " FROM message m INNER JOIN handle h ON h.ROWID=m.handle_id", ¬
    " WHERE m.is_read = 0  AND m.text IS NOT NULL AND m.is_from_me = 0 GROUP BY h.ROWID'", ¬
    " | egrep -io -e '\\w+ = .+'"] as text)
--> lastMessageDate = %timestamp%
--> id = %phone number or iMessage address%
--> text = %message content%
--> ...

-- Groups all messages into a single item of an array
-- Each occurence of  "lastMessageDate = " indicates 
-- a new message and, hence, a new array item.
set AppleScript's text item delimiters to "lastMessageDate = "
set Messages to rest of text items of Messages

-- Loop through the array organise each message
repeat with message in Messages

    -- Split the array item up into its components
    set [receivedOn, sentFrom, textContent, guid] ¬
        to [paragraph 1, ¬
        text 6 thru -1 of paragraph 2, ¬
        text 8 thru -1 of paragraph 3, ¬
        text 8 thru -1 of paragraph 4] of message

    set like_guid to "'\\''%" & guid & "'\\''"
    set AlreadySent to do shell script (["sqlite3 -line ", ¬
        quoted form of (Messages in db) as text, ¬
        " 'SELECT *", ¬
        " FROM message m WHERE m.text LIKE ", ¬
        like_guid, ¬
        "'"] as text)

    if AlreadySent = "" then
        tell application "Messages"
            set textContent to sentFrom & "

" & textContent & "

" & guid
            send textContent to participant "+1234567890" of account "SMS"
        end tell
    else
        log AlreadySent
    end if

end repeat

如果您注释掉这一行(即“发送文本内容到…”)然后你的脚本将被编译-请注意,这并不意味着它会工作。你应该添加你正在使用的操作系统/消息的版本,因为功能如何变化。也就是说,在Sierra上,没有“参与者”,只有“参与者”,这意味着一个好友列表。因此,请尝试对{“+1234567890”的第1项进行一些修改。也没有“帐户”。