3

I need an applescript, which can do the job below:

  • open the application Terminal with fullscreen
  • run some scripts

Here is what I've tried:

tell application "Terminal"
    tell window 1
        activate
        tell application "System Events"
            keystroke "f" using {control down, command down}    
        end tell
        do script "cd Documents/'cpp project'/test3" in window 1
        do script "./matrix.out" in window 1
    end tell
end tell

But it doesn't work.

  • In the future if you are having problems with a script, please be explicit about what's wrong and any error messages you encountered. – tubedogg Nov 12 '16 at 23:43
6

You need to be talking to Terminal, not window 1. This script worked fine for me.

tell application "Terminal"
    activate
    tell application "System Events"
        keystroke "f" using {control down, command down}
    end tell
    do script "cd ~/Downloads" in window 1
    do script "brew list" in window 1
end tell

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .