void RunDocumentToolStripMenuItem_Click(object sender, EventArgs e) { try { Macros.Parser p = new NotepadX.Macros.Parser((CurrentDocument as ITextEditor).DocumentText); Macros.Environment env = NotepadX.Macros.Environment.LastEnvironment==null ? new Macros.Environment() : Macros.Environment.LastEnvironment; MessageBox.Show(env.Run(p.Parsed.ToArray()).ToString()); } catch (Exception ex) { MessageBox.Show("Error: " + ex.ToString()); } }
public object RunMacro(string macro) { Macros.Parser p = new NotepadX.Macros.Parser(macro); Macros.Environment env = NotepadX.Macros.Environment.LastEnvironment==null ? new Macros.Environment() : Macros.Environment.LastEnvironment; return env.Run(p.Parsed.ToArray()); }