Created
June 2, 2011 19:07
-
-
Save danielwestendorf/1005066 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
framework 'Foundation' | |
framework 'ScriptingBridge' | |
terminal = SBApplication.applicationWithBundleIdentifier("com.apple.terminal") | |
load_bridge_support_file 'Terminal.bridgesupport' #load the bridge support file | |
new_tab = terminal.classForScriptingClass("tab").alloc #create a new tab instance | |
terminal.windows.first.tabs.addObject(new_tab) #add the tab to the first window | |
--> RuntimeError: NSInvalidArgumentException: *** -[SBElementArray addObject:]: can't add an object that already exists. |
Thanks Rob!
…On Thu, Jun 2, 2011 at 8:57 PM, RobertLowe ***@***.*** wrote:
Inject something into a tab:
# scripting into a tab:
terminal.windows.first.tabs.first.setSelected true
terminal.performSelector( :'doScript:in:', withObject:'echo hello', withObject:terminal.windows.first)
# open a new window (but not a new tab :( )
terminal.performSelector( :'doScript:in:', withObject:'echo hello', withObject:ni)
Maybe merbist knows, I'd really like to figure how to open a tab...
##
Reply to this email directly or view it on GitHub:
https://gist.github.com/1005066
Hacking with macruby is brutal and awesome.
No problem! If you're interested checkout my Mynu gem, I recently expanded it with some basic terminal support:
https://github.com/RobertLowe/mynu/blob/master/examples/terminal.rb
https://github.com/RobertLowe/mynu/blob/master/lib/mynu/support/terminal.rb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Inject something into a tab:
Maybe merbist knows, I'd really like to figure how to open a tab...