bsky
bsky

Reputation: 20222

Expected end of line, etc. but found “script”

I wrote a very basic apple script that opens iTerm and goes to a file:

tell application "iTerm"
    activate
    do script "cd ~" in tab 1
end tell

If I try to run this however, I get a Syntax Error:

Expected end of line, etc. but found “script”.

Any idea why this is the case?

Is there some incorrect syntax in this script?

Upvotes: 4

Views: 2340

Answers (1)

bsky
bsky

Reputation: 20222

Yes, it turns out that the syntax was incorrect.

This works:

tell application "iTerm"
    create window with default profile
    tell current session of current window
        write text "cd ~"
    end tell
end tell

Upvotes: 5

Related Questions