Пример #1
0
        private void do_mywork()
        {
            lvActions.Items.Clear();
            ClickType ct  = ClickType.click;
            int       x   = this.DesktopLocation.X + 16; //Cursor.Position.X;
            int       y   = this.DesktopLocation.Y + 8;  //Cursor.Position.Y;
            TimeSpan  ts  = end - start;
            double    sec = 0;

            if (nWait.Value.Equals(0))
            {
                sec = ts.TotalSeconds;
                sec = Math.Round(sec, 1);
            }
            else
            {
                sec = (double)nWait.Value;
            }
            start = end;
            string point = x.ToString() + "," + y.ToString();

            string       text  = ct.Equals(ClickType.SendKeys) ? txbEntry.Text : string.Empty;
            ListViewItem lvi   = new ListViewItem(new string[] { point, ct.ToString(), "0", text });
            ActionEntry  acion = new ActionEntry(x, y, text, 0, ct);

            lvi.Tag = acion;
            lvActions.Items.Add(lvi);
            int index = lvActions.Items.Count;

            if (index > 1)
            {
                lvActions.Items[index - 2].SubItems[2].Text = sec.ToString();
                (lvActions.Items[index - 2].Tag as ActionEntry).Interval = (int)sec;
            }

            toolStripStatusLabel1.Text = string.Format("Position: {0} ,{1}", x.ToString(), y.ToString());
            Application.DoEvents();

            enableButtons(false);

            if (runActionThread == null || !runActionThread.IsAlive)
            {
                actions.Clear();
                foreach (ListViewItem lvii in lvActions.Items)
                {
                    actions.Add(lvii.Tag as ActionEntry);
                }
                runActionThread = new Thread(RunAction);
                runActionThread.Start();
            }
        }
Пример #2
0
        private void editToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ActionEntry action = lvActions.SelectedItems[0].Tag as ActionEntry;
            EditWin     frm    = new EditWin(action);

            frm.Actionentry = action;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                action = frm.Actionentry;
                lvActions.SelectedItems[0].Tag              = action;
                lvActions.SelectedItems[0].Text             = action.X + "," + action.Y;
                lvActions.SelectedItems[0].SubItems[1].Text = action.Type.ToString();
                lvActions.SelectedItems[0].SubItems[2].Text = action.Interval.ToString();
                lvActions.SelectedItems[0].SubItems[3].Text = action.Text;
            }
        }
Пример #3
0
        private void OpenFileXml(bool runIt, string file)
        {
            //Get data from XML file
            XmlSerializer ser = new XmlSerializer(typeof(ActionsEntry));
            using (FileStream fs = System.IO.File.Open(file, FileMode.Open))
            {
                try
                {
                    ActionsEntry entry = (ActionsEntry)ser.Deserialize(fs);
                    lvActions.Items.Clear();
                    foreach (ActionsEntryAction ae in entry.Action)
                    {
                        string point = ae.X.ToString() + "," + ae.Y.ToString();
                        string interval = (ae.interval).ToString();
                        ListViewItem lvi = new ListViewItem(new string[] { point, ((ClickType)(ae.Type)).ToString(), interval, ae.Text });
                        ActionEntry acion = new ActionEntry(ae.X, ae.Y, ae.Text, ae.interval, (ClickType)(ae.Type));
                        lvi.Tag = acion;
                        lvActions.Items.Add(lvi);
                    }

                    if (runIt)
                    {
                        btnStart.PerformClick();
                    }

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Clicer", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #4
0
        private void Form1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (byTextEntry) return;

            if (e.KeyChar.Equals('c') || e.KeyChar.Equals('d')
                || e.KeyChar.Equals('r') || e.KeyChar.Equals('t'))
            {
                end = DateTime.Now;
                if (first)
                {
                    start = end;
                    first = false;
                }

                ClickType ct = ClickType.click;
                if (e.KeyChar.Equals('c'))
                {
                    //cl = ClickType.click;
                }
                else if (e.KeyChar.Equals('d'))
                {
                    ct = ClickType.doubleClick;
                }
                else if (e.KeyChar.Equals('r'))
                {
                    ct = ClickType.rightClick;
                }
                else //if (e.KeyChar.Equals('t'))
                {
                    ct = ClickType.SendKeys;
                }

                int x = Cursor.Position.X;
                int y = Cursor.Position.Y;
                TimeSpan ts = end - start;
                double sec = 0;
                if (nWait.Value.Equals(0))
                {
                    sec = ts.TotalSeconds;
                    sec = Math.Round(sec, 1);
                }
                else
                {
                    Properties.Settings.Default.a += nWait.Value;
                    sec = (double)nWait.Value;
                }
                start = end;
                string point = x.ToString() + "," + y.ToString();

                string text = ct.Equals(ClickType.SendKeys) ? txbEntry.Text : string.Empty;

                if (a == true)
                {
                    Random t = new Random();
                    ListViewItem lvi = new ListViewItem(new string[] { point, ct.ToString(), "0", text + t.Next((int)numericUpDown1.Value, (int)numericUpDown2.Value).ToString() });
                    ActionEntry acion = new ActionEntry(x, y, text + t.Next().ToString(), 0, ct);
                    lvi.Tag = acion;
                    lvActions.Items.Add(lvi);
                }
                else
                {
                    ListViewItem lvi = new ListViewItem(new string[] { point, ct.ToString(), "0", text });
                    ActionEntry acion = new ActionEntry(x, y, text , 0, ct);
                    lvi.Tag = acion;
                    lvActions.Items.Add(lvi);
                }

                int index = lvActions.Items.Count;
                if (index > 1)
                {
                    lvActions.Items[index - 2].SubItems[2].Text = sec.ToString();
                    (lvActions.Items[index - 2].Tag as ActionEntry).Interval = (int)sec;
                }
            }
            if (e.KeyChar.Equals('S'))
            {
                btnStart.PerformClick();
            }
            else if (e.KeyChar.Equals((char)Keys.Escape))//Esc
            {
                btnCancel.PerformClick();
                this.Focus();
            }
        }
Пример #5
0
        private void Form1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (byTextEntry)
            {
                return;
            }

            if (e.KeyChar.Equals('c') || e.KeyChar.Equals('d') ||
                e.KeyChar.Equals('r') || e.KeyChar.Equals('t'))
            {
                end = DateTime.Now;
                if (first)
                {
                    start = end;
                    first = false;
                }

                ClickType ct = ClickType.click;
                if (e.KeyChar.Equals('c'))
                {
                    //cl = ClickType.click;
                }
                else if (e.KeyChar.Equals('d'))
                {
                    ct = ClickType.doubleClick;
                }
                else if (e.KeyChar.Equals('r'))
                {
                    ct = ClickType.rightClick;
                }
                else //if (e.KeyChar.Equals('t'))
                {
                    ct = ClickType.SendKeys;
                }

                int      x   = Cursor.Position.X;
                int      y   = Cursor.Position.Y;
                TimeSpan ts  = end - start;
                double   sec = 0;
                if (nWait.Value.Equals(0))
                {
                    sec = ts.TotalSeconds;
                    sec = Math.Round(sec, 1);
                }
                else
                {
                    sec = (double)nWait.Value;
                }
                start = end;
                string point = x.ToString() + "," + y.ToString();

                string       text  = ct.Equals(ClickType.SendKeys) ? txbEntry.Text : string.Empty;
                ListViewItem lvi   = new ListViewItem(new string[] { point, ct.ToString(), "0", text });
                ActionEntry  acion = new ActionEntry(x, y, text, 0, ct);
                lvi.Tag = acion;
                lvActions.Items.Add(lvi);
                int index = lvActions.Items.Count;
                if (index > 1)
                {
                    lvActions.Items[index - 2].SubItems[2].Text = sec.ToString();
                    (lvActions.Items[index - 2].Tag as ActionEntry).Interval = (int)sec;
                }
            }
            if (e.KeyChar.Equals('S'))
            {
                btnStart.PerformClick();
            }
            else if (e.KeyChar.Equals((char)Keys.Escape))//Esc
            {
                btnCancel.PerformClick();
                this.Focus();
            }
        }
Пример #6
0
 public EditWin(ActionEntry action)
 {
     InitializeComponent();
     this.action = action;
 }
Пример #7
0
 public EditWin(ActionEntry action)
 {
     InitializeComponent();
     this.action = action;
 }
Пример #8
0
 public ویرایش(ActionEntry action)
 {
     InitializeComponent();
     this.action = action;
 }