(boolean debug)
| 554 | } |
| 555 | |
| 556 | final void runMacro(boolean debug) { |
| 557 | if (path!=null) |
| 558 | Macro_Runner.setFilePath(path); |
| 559 | if (getTitle().endsWith(".js")) |
| 560 | {evaluateJavaScript(); return;} |
| 561 | else if (getTitle().endsWith(".bsh")) |
| 562 | {evaluateScript(".bsh"); return;} |
| 563 | else if (getTitle().endsWith(".py")) |
| 564 | {evaluateScript(".py"); return;} |
| 565 | int start = ta.getSelectionStart(); |
| 566 | int end = ta.getSelectionEnd(); |
| 567 | String text; |
| 568 | if (start==end) |
| 569 | text = ta.getText(); |
| 570 | else |
| 571 | text = ta.getSelectedText(); |
| 572 | Interpreter.abort(); // abort any currently running macro |
| 573 | if (checkForCurlyQuotes) { |
| 574 | // replace curly quotes with standard quotes |
| 575 | text = text.replaceAll("\u201C", "\""); |
| 576 | text = text.replaceAll("\u201D", "\""); |
| 577 | if (start==end) |
| 578 | ta.setText(text); |
| 579 | else { |
| 580 | String text2 = ta.getText(); |
| 581 | text2 = text2.replaceAll("\u201C", "\""); |
| 582 | text2 = text2.replaceAll("\u201D", "\""); |
| 583 | ta.setText(text2); |
| 584 | } |
| 585 | checkForCurlyQuotes = false; |
| 586 | } |
| 587 | currentMacroEditor = this; |
| 588 | text = doInclude(text); |
| 589 | MacroRunner mr = new MacroRunner(); |
| 590 | if (debug) |
| 591 | mr.setEditor(this); |
| 592 | mr.run(text); |
| 593 | } |
| 594 | |
| 595 | /** Process optional #include statment at begining of macro. */ |
| 596 | public static String doInclude(String code) { |
no test coverage detected