[英]Running a psql command via Automator/Applescript and Terminal
I am having difficulties to run the following Applescript where I get this error message Expected “"” but found unknown token.
pointing to the "\\copy
. 我在运行下面的Applescript时遇到困难,在此我得到此错误消息
Expected “"” but found unknown token.
指向"\\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
Can anybody help or assist? 有人可以帮忙吗? I would like to keep this in Automator-Applescript-Terminal so that it can easily be used by others in my team.
我想将此保留在Automator-Applescript-Terminal中,以便其他人可以轻松使用。
Thank you, Alex 谢谢亚历克斯
...of course, the backslash '\\' is the issue - got to put double '\\' in order for Applescript to understand the second '\\' literally. ...当然,反斜杠'\\'是个问题-必须加上双'\\'以便Applescript逐字理解第二个'\\'。 Technical note on developer.apple.com Thanks, Alex
developer.apple.com上的技术说明谢谢,Alex
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.