Terminal 通过Automator/Applescript和终端运行psql命令

Terminal 通过Automator/Applescript和终端运行psql命令,terminal,applescript,psql,Terminal,Applescript,Psql,我在运行以下Applescript时遇到困难,我在其中收到此错误消息预期为“”,但发现未知令牌。指向“\copy on run {input, parameters} tell application "Terminal" activate do script with command "psql -h host -d server -U user” in front window delay 3 do script “pa

我在运行以下Applescript时遇到困难,我在其中收到此错误消息
预期为“”,但发现未知令牌。
指向
“\copy

on run {input, parameters}
    tell application "Terminal"
        activate
        do script with command "psql -h host -d server -U user” in front window
        delay 3
        do script “password” in front window
        delay 3
        do script with command "\copy (SELECT query_to_xml('SELECT jobs.name FROM jobs WHERE jobs.id = 012345’, true, true, '')) TO '/Users/alex/result_sql.xml' " in front window
    end tell
end run
有人能帮忙吗?我想把它保存在Automator Applescript Terminal中,以便团队中的其他人可以轻松地使用它


谢谢你,Alex

…当然,反斜杠“\”是个问题-为了让Applescript能够理解第二个“\”的字面意思,必须加上双“\”。
谢谢,亚历克斯

乔治,非常感谢你编辑我的问题-这看起来更好。亚历克斯