Question

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?

Was it helpful?

Solution

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/").

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top