Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- The MIT License (MIT)
- Copyright (c) 2013 Techrocket9
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- */
- // Spams clicks at the cursor after a short delay
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Runtime.InteropServices;
- using System.Threading;
- namespace ClickSpam
- {
- class Program
- {
- static void Main(string[] args)
- {
- int count = 6000; // Number of clicks to click
- Console.WriteLine("Beginning " + count + " clicks in 2.5 seconds");
- Thread.Sleep(2500);
- int MOUSEEVENTF_LEFTDOWN = 0x02;
- int MOUSEEVENTF_LEFTUP = 0x04;
- int MOUSEEVENTF_RIGHTDOWN = 0x08;
- int MOUSEEVENTF_RIGHTUP = 0x10;
- int x = 0;
- int y = 0;
- while (true)
- {
- mouse_event(MOUSEEVENTF_LEFTDOWN, x, y, 0, 0);
- mouse_event(MOUSEEVENTF_LEFTUP, x, y, 0, 0);
- --count;
- Thread.Sleep(8); // Tune up or down as tolerated
- if (count < 0)
- {
- break;
- }
- }
- }
- // Most of the junk below this line probably isn't necessary. Pretty sure that DllImport and the immediately
- // following line are all that matter.
- private const UInt32 MOUSEEVENTF_LEFTDOWN = 0x0002;
- private const UInt32 MOUSEEVENTF_LEFTUP = 0x0004;
- [DllImport("user32.dll")]
- public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
- public const int MOUSEEVENTF_RIGHTDOWN = 0x08;
- public const int MOUSEEVENTF_RIGHTUP = 0x10;
- public void MouseClick()
- {
- int x = 100;
- int y = 100;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment