public static void runShutdownScripts() {
    for (int i = 0, limit = Outliner.scriptsManager.model.getSize(); i < limit; i++) {
      Script script = Outliner.scriptsManager.model.get(i);

      if (script.isShutdownScript()) {
        runScript(script, SHUTDOWN_SCRIPT);
      }
    }
  }
  public int indexOf(String name) {
    for (int i = 0, limit = scripts.size(); i < limit; i++) {
      Script script = get(i);
      if (script.getName().equals(name)) {
        return i;
      }
    }

    return -1;
  }
  // Static Methods
  public static void runStartupScripts() {
    if (Outliner.scriptsManager != null) {
      if (Outliner.scriptsManager.model != null) {
        for (int i = 0, limit = Outliner.scriptsManager.model.getSize(); i < limit; i++) {
          Script script = Outliner.scriptsManager.model.get(i);

          if (script.isStartupScript()) {
            runScript(script, STARTUP_SCRIPT);
          }
        }
      } else {
        System.out.println("Error: ScriptsManagerModel was null");
      }
    } else {
      System.out.println("Error: ScriptsManager was null");
    }
  }
  // Add/Insert
  public int add(Script script) {
    // Find the correct spot to add it alphabetically
    int i, limit;
    for (i = 0, limit = scripts.size(); i < limit; i++) {
      Script scriptTemp = (Script) scripts.get(i);
      if (scriptTemp.getName().compareTo(script.getName()) >= 0) {
        break;
      }
    }

    scripts.add(i, script);

    // Update the table
    fireTableRowsInserted(i, i);

    return i;
  }
  public static void runScript(Script script, int scriptType) {
    if (scriptType == SHUTDOWN_SCRIPT) {
      try {
        script.process();
      } catch (Exception e) {
        System.out.println(e.getMessage());
      }
    } else {
      // Create a new Thread
      ScriptThread scriptThread = new ScriptThread(script, scriptType);

      // Run the Thread
      scriptThread.start();
    }
  }