Example #1
0
        private static void Start(
            string proposedAcName,
            string processName,
            Coordinates coordinates,
            int interval
            )
        {
            var acWorker = VacEnvironment.GetAcWorker();
            var acName   = proposedAcName;

            if (string.IsNullOrWhiteSpace(acName))
            {
                acName = Guid.NewGuid().ToString();
            }

            var ac = new AutoClicker
            {
                Name        = acName,
                Active      = true,
                Coordinates = coordinates,
                Interval    = interval,
                ProcessName = processName,
            };

            try
            {
                acWorker?.AutoClickers?.Add(acName, ac);
                ac.Init();

                ConsoleHelper.WriteMessage($"Autoclicker '{acName}' started!");
            }
            catch (Exception exc)
            {
                // Something went wrong, ensure the autoclicker worker doesn't keep track of this instance anymore.
                if (acWorker is { } && acName is { })
    public void AutoClickerDelegateImplementation(AutoClicker autoClickerScript)
    {
        //Debug.Log("Auto-clicking!");

        // Click the enemy.
        ClickEnemy();
    }
Example #3
0
 private static void OnTimedEvent(object source, System.Timers.ElapsedEventArgs e)
 {
     System.IntPtr foreground;
     if ((foreground = AutoClicker.FindWindow(foregroundWindow, null)) == AutoClicker.hWnd)
     {
         SendKeys.SendWait("{Y}");
     }
     else
     {
         System.Timers.Timer aTimer = (System.Timers.Timer)source;
         aTimer.Stop();
     }
 }
Example #4
0
        private void button4_Click(object sender, EventArgs e)
        {
            foregroundWindow = textBox_msAppTitle.Text;
            if ((AutoClicker.hWnd = AutoClicker.FindWindow(foregroundWindow, null)) != IntPtr.Zero)
            {
                AutoClicker.RegisterHotKey(this.Handle, 10, 0x0002, 0x11);//Ctrl
                AutoClicker.SetForegroundWindow(AutoClicker.hWnd);


                System.Timers.Timer aTimer = new System.Timers.Timer();
                aTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimedEvent);
                // Set the Interval to 5 seconds.
                aTimer.Interval = (double)numericUpDown1.Value;
                aTimer.Enabled  = true;
            }
            else
            {
                MessageBox.Show("Application Window not found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
        }
Example #5
0
 public ClearCommand(AutoClicker instance)
 => this.instance = instance;
Example #6
0
 public DeactivateCommand(AutoClicker instance)
 => this.instance = instance;
Example #7
0
 public HelpCommand(AutoClicker instance)
 => this.instance = instance;
 public RemoveClickerCommand(AutoClicker instance)
 => this.instance = instance;
Example #9
0
 public CommandHandler(AutoClicker instance)
 {
     this.run      = true;
     this.instance = instance;
     this.commands = new Dictionary <string, ICommand>();
 }
Example #10
0
 public ExitCommand(AutoClicker instance)
 => this.instance = instance;
Example #11
0
 public AddClickerCommand(AutoClicker instance)
 => this.instance = instance;
Example #12
0
 public ButtonCommand(AutoClicker instance)
 => this.instance = instance;