terminal – Automator script error -212


Have you ever tried working that script immediately from Script Editor?  (That is in all probability one of the best ways to debug (and to put in writing!) AppleScript.)

I did, and it stops on the primary line with a (completely different) error message.

However after eradicating the {enter, parameters}, it runs high quality.  (I am guessing that the documentation you bought that from was indicating that you would use both enter or parameters — although the truth is it is taken as an identifier, so any single phrase will do.  Because it’s elective, the only factor is to omit it fully.)

In order that appears to be the fast downside.

Nevertheless, that is not the one downside with the script.  The activate command brings the Terminal app to the entrance, together with any home windows it has already open.  However every do script opens a new window with a brand new shell, and runs the command there — it does not have an effect on any home windows which have been already open (which I assume is your intent).

To do this, you must inform it to make use of an present window.  The best means appears to be do script "……" in window 0, which makes use of the present tab within the frontmost window.

(There are different variations which might let you choose different tabs and home windows.  See the Terminal documentation for extra; the only means is to run ‘File → Open Dictionary…’ from the Script Editor, and select ‘Terminal.app’ from the ensuing dialog.)

(Observe: this was examined on macOS 12 Monterey, however I anticipate it will apply to some earlier and later variations too.)

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *