AppleScript: So öffnen Sie das Terminal im Vollbildmodus und führen Befehle aus

Ich brauche ein Applescript, das die folgende Aufgabe erledigen kann:

  • Öffnen Sie die Anwendung Terminal im Vollbildmodus
  • Führen Sie einige Skripte aus

Hier ist, was ich versucht habe:

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

Aber es funktioniert nicht.

Wenn Sie in Zukunft Probleme mit einem Skript haben, geben Sie bitte explizit an, was falsch ist und welche Fehlermeldungen Ihnen begegnet sind.

Antworten (1)

Sie müssen mit Terminal sprechen, nicht mit window 1. Dieses Skript hat bei mir gut funktioniert.

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