示例#1
0
        public CommandInput(CommandType inputType, Keys key, int x, int y, bool mouseWheelDirectionUp, bool rightMouseButton, Macro macro)
        {
            m_macro = macro;

            InputType = inputType;

            switch (inputType)
            {
            case CommandType.KeyDown:
                Key  = key;
                Text = "Keydown " + Key;
                break;

            case CommandType.KeyUp:
                Key  = key;
                Text = "Keyup " + Key;
                break;

            case CommandType.MouseDown:
                IsRightButton = rightMouseButton;
                X             = x;
                Y             = y;
                Text          = "MouseDown " + (IsRightButton ? "Rightclick" : "Leftclick") + " at (" + X + "/" + Y + ")";
                break;

            case CommandType.MouseUp:
                IsRightButton = rightMouseButton;
                X             = x;
                Y             = y;
                Text          = "MouseUp " + (IsRightButton ? "Rightclick" : "Leftclick") + " at (" + X + "/" + Y + ")";
                break;

            case CommandType.MouseMove:
                X    = x;
                Y    = y;
                Text = "MouseMove (" + X + "/" + Y + ")";
                break;

            case CommandType.MouseWheel:
                IsMouseWheelUp = mouseWheelDirectionUp;
                X    = x;
                Y    = y;
                Text = "MouseWheel " + (IsMouseWheelUp ? "Up" : "Down") + " at (" + X + "/" + Y + ")";
                break;

            default:
                break;
            }

            ImageKey         = "key";
            SelectedImageKey = "key";
            Name             = "command";
        }
示例#2
0
        private void tsmiReplayMacro_Click(object sender, EventArgs e)
        {
            Macro m = (Macro)m_selectedNode;

            m.StartReplayThread(false);
        }
示例#3
0
        private void tsmiStopReplay_Click(object sender, EventArgs e)
        {
            Macro m = (Macro)m_selectedNode;

            m.StopReplayThread();
        }
示例#4
0
        private void tvMakros_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            tvMakros.SelectedNode = e.Node;

            if (e.Button == MouseButtons.Left)
            {
                if (e.Node.GetType() == typeof(CommandWait))
                {
                    CommandWait c = (CommandWait)tvMakros.SelectedNode;

                    FormCommandWait frm = new FormCommandWait(c.Duration);
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        c.Duration = frm.WaitDuration;
                    }
                }
                else if (e.Node.GetType() == typeof(ActivatorShortcut))
                {
                    ActivatorShortcut     a   = (ActivatorShortcut)e.Node;
                    FormActivatorShortcut frm = new FormActivatorShortcut(a.Shortcut, a.LoopexEcution);
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        a.Shortcut.Keys = frm.Shortcut.Keys;
                        a.Shortcut      = a.Shortcut;
                        a.LoopexEcution = frm.LoopExecution;
                    }
                }
                else if (e.Node.GetType() == typeof(ActivatorTime))
                {
                    ActivatorTime     a   = (ActivatorTime)e.Node;
                    FormActivatorTime frm = new FormActivatorTime(a.TriggerTime, a.TriggerInterval);
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        a.TriggerTime     = frm.TriggerTime;
                        a.TriggerInterval = frm.TriggerInterval;
                    }
                }
                else if (e.Node.GetType() == typeof(CommandInput))
                {
                    Macro            m   = Macro.GetMacroByChild(m_selectedNode);
                    FormCommandInput frm = new FormCommandInput((CommandInput)e.Node, m);
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        e.Node.Parent.Nodes.Insert(e.Node.Index, frm.CommandInput);
                        e.Node.Remove();
                    }
                }
                else if (e.Node.GetType() == typeof(ConditionNode))
                {
                    Macro         m  = Macro.GetMacroByChild(tvMakros.SelectedNode);
                    ConditionNode cn = (ConditionNode)e.Node;

                    FormCondition frm = null;
                    if (cn.Condition != null)
                    {
                        frm = new FormCondition(cn.Condition, m);
                    }
                    else
                    {
                        frm = new FormCondition(m);
                    }

                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        cn.Condition = frm.Condition;
                    }
                }
                else if (e.Node.GetType() == typeof(CommandSetVariable))
                {
                    CommandSetVariable c = (CommandSetVariable)m_selectedNode;
                    Macro m = Macro.GetMacroByChild(c);
                    FormCommandSetVariable frm = new FormCommandSetVariable((c.Variable != null ? c.Variable.Name : ""), c.Output, m);
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        c.Variable = frm.Variable;
                        c.Output   = frm.Output;
                    }
                }
                else if (e.Node.GetType() == typeof(CommandReplayMakro))
                {
                    CommandReplayMakro     c   = (CommandReplayMakro)m_selectedNode;
                    FormCommandReplayMacro frm = new FormCommandReplayMacro(c.MacroName);
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        c.MacroName = frm.MacroName;
                    }
                }
                else if (e.Node.GetType() == typeof(CommandWriteFile))
                {
                    Macro                m   = Macro.GetMacroByChild(m_selectedNode);
                    CommandWriteFile     c   = (CommandWriteFile)m_selectedNode;
                    FormCommandWriteFile frm = new FormCommandWriteFile(c.FileName, c.FileText, c.AppendFile, m);
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        c.FileName   = frm.FileName;
                        c.FileText   = frm.Text;
                        c.AppendFile = frm.AppendFile;
                    }
                }
            }
        }
示例#5
0
        public ConditionAnd(Macro macro)
        {
            m_macro = macro;

            CreateUI();
        }
示例#6
0
        public ConditionCompareOutputs(Output output1, string conditionOperator, Output output2, Macro macro)
        {
            Text = "Vergleiche Variable";
            Name = "conditionCompareText";

            Output1           = output1;
            ConditionOperator = conditionOperator;
            Output2           = output2;
            m_macro           = macro;

            CreateUI();
        }
示例#7
0
        private void InputDetection_InputDetected1(CommandType inputType, Keys key, int x, int y, bool mouseWheelDirection, bool rightMouseButton)
        {
            if (m_lastCommandTime != DateTime.MinValue)
            {
                CommandWait cw = new CommandWait((int)(DateTime.Now - m_lastCommandTime).TotalMilliseconds, Macro.GetMacroByChild(m_node));
                cw.Duration = Math.Max(cw.Duration, 30);
                m_node.Nodes.Add(cw);
            }

            CommandInput ci = new CommandInput(inputType, key, x, y, mouseWheelDirection, rightMouseButton, Macro.GetMacroByChild(m_node));

            m_node.Nodes.Add(ci);

            m_lastCommandTime = DateTime.Now;
        }
示例#8
0
        public ConditionWaitFor(Macro macro)
        {
            m_macro = macro;

            CreateUI();
        }