parameters: (command)
docstring: Run a shell command in a new Terminal.app window.
docstring_summary: Run a shell command in a new Terminal.app window.
docstring_tokens: Run a shell command in a new Terminal . app window .
function: def run(command):
      """Run a shell command in a new Terminal.app window."""
      termAddress = AE.AECreateDesc(typeApplicationBundleID, "com.apple.Terminal")
      theEvent = AE.AECreateAppleEvent(kAECoreSuite, kAEDoScript, termAddress,
                                       kAutoGenerateReturnID, kAnyTransactionID)
      commandDesc = AE.AECreateDesc(typeChar, command)
      theEvent.AEPutParamDesc(kAECommandClass, commandDesc)
  
      try:
          theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout)
      except AE.Error, why:
          if why[0] != -600:  # Terminal.app not yet running
              raise
          os.system(START_TERMINAL)
          time.sleep(1)
          theEvent.AESend(SEND_MODE, kAENormalPriority, kAEDefaultTimeout)
function_tokens: def run ( command ) : termAddress = AE . AECreateDesc ( typeApplicationBundleID , "com.apple.Terminal" ) theEvent = AE . AECreateAppleEvent ( kAECoreSuite , kAEDoScript , termAddress , kAutoGenerateReturnID , kAnyTransactionID ) commandDesc = AE . AECreateDesc ( typeChar , command ) theEvent . AEPutParamDesc ( kAECommandClass , commandDesc ) try : theEvent . AESend ( SEND_MODE , kAENormalPriority , kAEDefaultTimeout ) except AE . Error , why : if why [ 0 ] != - 600 : # Terminal.app not yet running raise os . system ( START_TERMINAL ) time . sleep ( 1 ) theEvent . AESend ( SEND_MODE , kAENormalPriority , kAEDefaultTimeout )