I'm trying to use Applescript to open up terminal and make terminal run the commands given. Here is my code:

tell application "Terminal"
set currentTab to do script ("cd Desktop\")
delay 6
do script ("python2.7-32 snake.py") in currentTab
end tell

When I go and enter it into terminal manually, it works! But when I try to do it in apple script, it gives me an error what says "Expected “,” but found identifier."

How do I fix this?

有帮助吗?

解决方案

Just a guess but that backslash in ("cd Desktop\") will escape the double quote, which is probably upsetting the parser.

This is not Windows, so the path separator is forward slash ("cd Desktop/").

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top