Exemple #1
0
        private async Task btnTryClick_ClickAsync(object sender, EventArgs e)
        {
            var config = GetConfig();

            if (config != null)
            {
                if (config.IsDisabledTemp)
                {
                    MessageBox.Show("Script was disabled temporarily!");
                }
                else
                {
                    if (config.IsDrag)
                    {
                        await MouseOperation.ClickAndDragAsync(GlobalConfig.WindowHandle, config);
                    }
                    else
                    {
                        var isOk = await MouseOperation.ClickSpeedModeAsync(GlobalConfig.WindowHandle, config);

                        if (!isOk)
                        {
                            MessageBox.Show("Position not found!");
                        }
                    }
                }
            }
        }
Exemple #2
0
        private async Task btnTryClick_ClickAsync(object sender, EventArgs e)
        {
            if (lsvScripts.SelectedItems.Count > 0)
            {
                var no = int.Parse(lsvScripts.SelectedItems[0].SubItems[0].Text);
                if (no > 0)
                {
                    var config = Configs.FirstOrDefault(s => s.No == no);
                    if (config != null)
                    {
                        if (config.IsDisabledTemp)
                        {
                            MessageBox.Show("Script was disabled temporarily!");
                        }
                        else
                        {
                            var isOk = await MouseOperation.ClickSpeedModeAsync(config.WindowHandle, config);

                            if (!isOk)
                            {
                                MessageBox.Show("Position not found!");
                            }
                        }
                    }
                }
            }
        }
Exemple #3
0
        private async Task RunAsync(Configuration.Config config)
        {
            //txtProgress.AppendText($"- Script No : {config.No}. Description: {config.Description}. {Environment.NewLine}");

            await Task.Delay(config.Delay);

            lock (padlock)
            {
                if (isRun == false)
                {
                    return;
                }
            }

            // Make Calculator the foreground application and send it
            // a set of calculations.

            ClickOnPointTool.SetForegroundWindow(config.WindowHandle);
            //ClickOnPointTool.ShowActiveWindow(config.WindowHandle);

            //if (LoadingConfigs != null && LoadingConfigs.Count > 0)
            //{
            //    var loadingItem = LoadingConfigs[0];
            //    var loadingColor = await MouseOperation.GetColorAt(new Point(loadingItem.XPos, loadingItem.YPos));
            //    while (loadingColor.Name == loadingItem.ColorName)
            //    {
            //        txtProgress.AppendText($"- Script No : {config.No}. Loading.... {Environment.NewLine}");

            //        loadingColor = await MouseOperation.GetColorAt(new Point(loadingItem.XPos, loadingItem.YPos));

            //    }
            //}

            if (config.IsSequential)
            {
                if (config.IsDrag)
                {
                    await ClickOnPointTool.ClickAndDragAsync(config.WindowHandle, new Point(config.XPos, config.YPos), config.ColorName, new Point(config.XPosMoved, config.YPosMoved), new Point(config.XPosIgnored, config.XPosIgnored), config.ColorMovedName);
                }
                else
                {
                    await MouseOperation.SendMessageAsync(config.WindowHandle,
                                                          (int)MouseOperation.MouseEventFlags.LeftDown, 1, config, LoadingConfigs);

                    await MouseOperation.SendMessageAsync(config.WindowHandle,
                                                          (int)MouseOperation.MouseEventFlags.LeftUp, 0, config, LoadingConfigs);
                }
            }
            else // Speed mode
            {
                if (config.IsDrag)
                {
                    await ClickOnPointTool.ClickAndDragAsync(config.WindowHandle, new Point(config.XPos, config.YPos), config.ColorName, new Point(config.XPosMoved, config.YPosMoved), new Point(config.XPosIgnored, config.XPosIgnored), config.ColorMovedName);
                }
                else
                {
                    var isOk = await MouseOperation.ClickSpeedModeAsync(config.WindowHandle, config);

                    if (isOk)
                    {
                        // Do something else
                        if (config.RunOnce)
                        {
                            config.IsDisabledTemp = true;
                        }
                    }
                }
            }
        }