Macos 将iMessage内容传递给google

Macos 将iMessage内容传递给google,macos,automation,applescript,imessage,macos-big-sur,Macos,Automation,Applescript,Imessage,Macos Big Sur,我男朋友现在在法学院,他在谈论他的课程时给我发了很多法律术语 我想做的是编写一个AppleScript,将iMessage的内容传递到打开到Google.com的Safari窗口,以节省使用Google术语的时间(最终我想学习如何解析足够多的文本以找到术语并传递单个项目,但这可能超出了我的掌握范围)。以下是到目前为止我得到的信息: using terms from application "Messages" -- Trigger on a message conta

我男朋友现在在法学院,他在谈论他的课程时给我发了很多法律术语

我想做的是编写一个AppleScript,将iMessage的内容传递到打开到Google.com的Safari窗口,以节省使用Google术语的时间(最终我想学习如何解析足够多的文本以找到术语并传递单个项目,但这可能超出了我的掌握范围)。以下是到目前为止我得到的信息:

using terms from application "Messages"
    -- Trigger on a message containing Lee, doesn't seem to work
    on message with Lee
    -- Make Safari the active window
    activate application "Safari"
    end message
     -- Open Google
    tell application "Safari" to open location "https://www.google.com"
    end using terms from
-- testing marker so it'll type an L when it triggers
delay 1
tell application "System Events" to tell process "Safari"
key code 37
end tell
end
主要问题: 我找不到如何将消息作为字符串进行操作,我的假设是我将消息设置为字符串,将字符串设置为变量,然后将该变量传递给Safari以进入搜索框

我提前为这段代码的不合理表示歉意,我用AppleScript写的唯一一件事就是填写时间表的脚本,这花了我一整天的时间。还在学习,谢谢你的耐心