Пример #1
0
        private void ExecuteGuiMacro(string asMacro)
        {
            // conemuc.exe -silent -guimacro:1234 print("\e","git"," --version","\n")
            string ConEmuCD = GetConEmuCD();

            if (ConEmuCD == null)
            {
                throw new GuiMacroException("ConEmuCD must not be null");
            }

            if (guiMacro != null && guiMacro.LibraryPath != ConEmuCD)
            {
                guiMacro = null;
            }

            try
            {
                if (guiMacro == null)
                {
                    guiMacro = new GuiMacro(ConEmuCD);
                }
                guiMacro.Execute(ConEmu.Id.ToString(), asMacro,
                                 (GuiMacro.GuiMacroResult code, string data) => {
                    Debugger.Log(0, "GuiMacroResult", "code=" + code.ToString() + "; data=" + data + "\n");
                });
            }
            catch (GuiMacroException e)
            {
                MessageBox.Show(e.Message, "GuiMacroException", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #2
0
        private void ExecuteGuiMacro(string asMacro)
        {
            // conemuc.exe -silent -guimacro:1234 print("\e","git"," --version","\n")
            string ConEmuCD = GetConEmuCD();
            if (ConEmuCD == null)
            {
                throw new GuiMacroException("ConEmuCD must not be null");
            }

            if (guiMacro != null && guiMacro.LibraryPath != ConEmuCD)
            {
                guiMacro = null;
            }

            string lsResult;
            try
            {
                if (guiMacro == null)
                    guiMacro = new GuiMacro(ConEmuCD);
                lsResult = guiMacro.Execute(ConEmu.Id.ToString(), asMacro);
                Debugger.Log(0, "GuiMacroResult", lsResult+"\n");
            }
            catch (GuiMacroException e)
            {
                MessageBox.Show(e.Message, "GuiMacroException", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }