[MacRuby-devel] Scripting Terminal.app with ScriptingBridge

Scott Thompson easco at mac.com
Thu Jun 2 18:43:47 PDT 2011


> 
> I'm playing around with Scripting Bridge trying to script
> Terminal.app. I'm running into issues with adding a new tab to a
> window, and was hoping someone could point me in the right direction.
> Consider this gist: https://gist.github.com/1005066
> 
> The only information I could find that was remotely similar was doing
> something similar with Safari here:
> http://stackoverflow.com/questions/2912161/new-tab-in-safari-window-from-cocoa-and-scripting-bridge
> I tried converting that over to MacRuby, and I get the same error as
> when I try my gist above.
> 
> RuntimeError: NSInvalidArgumentException: *** -[SBElementArray
> addObject:]: can't add an object that already exists.
> 
> Hopefully I'm just doing something silly?

>From what I've been able to find on the Web, the terminal app doesn't allow you to create a new tab using AppleScript (directly).  Instead what you have to do is address the System Events application and use it to issue a "cmd-T" command.

I would also report a bug against Terminal.app on bugreport.apple.com.

Scott



More information about the MacRuby-devel mailing list